| GET | /v1/{VehicleType}/Vehicle/{vehicleIdentifier} | Get vehicle data by commission number |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OfferVehicle:
retail_price_ex_v_a_t: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Offer:
id: int = 0
offer_type: Optional[str] = None
campaign_name: Optional[str] = None
from_: Optional[str] = field(metadata=config(field_name='from'), default=None)
to: Optional[str] = None
value: Optional[str] = None
net: Optional[Decimal] = None
offer_vehicle: Optional[OfferVehicle] = None
pending: bool = False
document_url: Optional[str] = None
personalised: bool = False
is_personalised_monetary_offer: bool = False
campaign_v_i_p_discount: bool = False
offer_value_net: Optional[Decimal] = None
campaign_government_grant: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PersonalisedOffer(Offer):
category: Optional[str] = None
description: Optional[str] = None
reference: Optional[str] = None
campaign_id: int = 0
certificate_required: Optional[bool] = None
auto_select: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Message:
id: int = 0
vin: Optional[str] = None
campaign_id: int = 0
value: Optional[str] = None
campaign_description: Optional[str] = None
from_: Optional[str] = field(metadata=config(field_name='from'), default=None)
to: Optional[str] = None
document_url: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class OfferHistory:
id: int = 0
audit_type: Optional[str] = None
offer_type: Optional[str] = None
source: Optional[str] = None
from_: Optional[str] = field(metadata=config(field_name='from'), default=None)
to: Optional[str] = None
personalised: bool = False
value: Optional[str] = None
net: Optional[str] = None
vat: Optional[str] = None
description: Optional[str] = None
vin: Optional[str] = None
gssn: Optional[str] = None
creation: Optional[str] = None
modified: Optional[str] = None
user_id: Optional[str] = None
user: int = 0
offer_id: int = 0
commission_number: Optional[str] = None
campaign_id: Optional[int] = None
campaign_description: Optional[str] = None
creation_date: datetime.datetime = datetime.datetime(1, 1, 1)
is_used_car_offer: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class FinanceOffer:
campaign_description: Optional[str] = None
terms_and_conditions: Optional[str] = None
label: Optional[str] = None
campaign_id: int = 0
document_url: Optional[str] = None
from_: Optional[str] = field(metadata=config(field_name='from'), default=None)
id: int = 0
to: Optional[str] = None
value: Optional[str] = None
vin: Optional[str] = None
enabled: bool = False
pending: bool = False
offer_type: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleByIdentifierResponse:
campaign_offers: List[Offer] = field(default_factory=list)
campaign_personalised_offers: List[PersonalisedOffer] = field(default_factory=list)
campaign_government_grant_offers: List[Offer] = field(default_factory=list)
campaign_messages: List[Message] = field(default_factory=list)
offer_histories: Optional[List[OfferHistory]] = None
finance_offers: Optional[List[FinanceOffer]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleDataBase:
vin: Optional[str] = None
description: Optional[str] = None
model: Optional[str] = None
otr: Optional[str] = None
retail_price_ex_v_a_t: Optional[str] = None
actual_price: Optional[str] = None
p11_d: Optional[str] = None
fuel_type: Optional[str] = None
transmission: Optional[str] = None
transmission_type: Optional[str] = None
colour: Optional[str] = None
colour_code: Optional[str] = None
colour_description: Optional[str] = None
commission_number: Optional[str] = None
offer_available: bool = False
campaign_discount_offer_total: int = 0
campaign_discount_offer_total_current: int = 0
campaign_discount_offer_total_pending: int = 0
campaign_service_offer_total: int = 0
campaign_service_offer_total_current: int = 0
campaign_service_offer_total_pending: int = 0
campaign_custom_offer_total: int = 0
campaign_personalised_offer_total_current: int = 0
campaign_personalised_offer_total_pending: int = 0
campaign_personalised_offer_total: int = 0
campaign_custom_offer_total_current: int = 0
campaign_custom_offer_total_pending: int = 0
campaign_other_offer_total: int = 0
campaign_other_offer_total_current: int = 0
campaign_other_offer_total_pending: int = 0
retailer_discount_offer_total: int = 0
retailer_discount_offer_total_current: int = 0
retailer_discount_offer_total_pending: int = 0
retailer_service_offer_total: int = 0
retailer_service_offer_total_current: int = 0
retailer_service_offer_total_pending: int = 0
retailer_custom_offer_total: int = 0
retailer_custom_offer_total_current: int = 0
retailer_custom_offer_total_pending: int = 0
retailer_warranty_offer_total: int = 0
retailer_warranty_offer_total_current: int = 0
retailer_warranty_offer_total_pending: int = 0
retailer_offer_total: int = 0
retailer_offer_total_current: int = 0
retailer_offer_total_pending: int = 0
campaign_offer_total: int = 0
campaign_offer_total_current: int = 0
campaign_offer_total_pending: int = 0
campaign_and_offer_total: int = 0
campaign_and_offer_total_current: int = 0
campaign_and_offer_total_pending: int = 0
offer_total: int = 0
offer_total_current: int = 0
offer_total_pending: int = 0
creation: Optional[str] = None
modified: Optional[str] = None
electric_range: int = 0
electric_consumption: int = 0
port_arrival_date: Optional[datetime.datetime] = None
days_since_port_arrival: Optional[int] = None
retail_price_inc_v_a_t: Decimal = decimal.Decimal(0)
body_style: Optional[str] = None
upholstery: Optional[str] = None
upholstery_code: Optional[str] = None
upholstery_type: Optional[str] = None
package_names: List[str] = field(default_factory=list)
line: Optional[str] = None
current_retailer_offer_price: Decimal = decimal.Decimal(0)
retail_price: Optional[str] = None
vat_qualifying: bool = False
retailer_id: int = 0
gssn_id: Optional[str] = None
no_image: bool = False
image_url: Optional[str] = None
is_available_online: bool = False
is_back_ordered: bool = False
creation_date: Optional[str] = None
maintenance_date: Optional[str] = None
registration_number: Optional[str] = None
registration_date: Optional[datetime.datetime] = None
mileage: Optional[int] = None
trade_in_date: Optional[datetime.datetime] = None
source: Optional[str] = None
vehicle_type: Optional[str] = None
offer_amount: Optional[str] = None
offer_expiry: Optional[str] = None
active_offers: List[int] = field(default_factory=list)
campaign_messages_total: int = 0
under_offer: bool = False
is_display_stock: bool = False
display_retailer: Optional[str] = None
display_retailer_gssn_id: Optional[str] = None
location: Optional[str] = None
account: Optional[str] = None
account_type: Optional[str] = None
usage_code: Optional[str] = None
bm7_n_s_t: Optional[str] = None
is_sellable: bool = False
secured: bool = False
specialist: bool = False
is_motability_retailer: bool = False
upholstery_description: Optional[str] = None
in_back_order_account: bool = False
full_model_year_code: Optional[str] = None
production_date: Optional[datetime.datetime] = None
baumuster: Optional[str] = None
is_motability: bool = False
pip_advance_rental_gross: Optional[Decimal] = None
wpms_advance_rental_gross: Optional[Decimal] = None
isp_vehicle_customer_descriptions: Optional[List[str]] = None
eligible_for_ma_transfer: bool = False
confirmed_production_date: Optional[str] = None
forecasted_arrival_date: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleData(VehicleDataBase):
engine: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Equipment:
id: Optional[int] = None
code: Optional[str] = None
description: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleIdentifierData(VehicleData):
retailer: Optional[str] = None
has_motability_error: bool = False
equipment: List[Equipment] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleByCommissionNumberResponse(VehicleByIdentifierResponse):
vehicle: Optional[VehicleIdentifierData] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleByCommissionNumberRequest(IGet):
vehicle_identifier: Optional[str] = None
vehicle_type: Optional[str] = None
Python VehicleByCommissionNumberRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/{VehicleType}/Vehicle/{vehicleIdentifier} HTTP/1.1
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
vehicle:
{
retailer: String,
hasMotabilityError: False,
equipment:
[
{
id: 0,
code: String,
description: String
}
],
engine: String,
vin: String,
description: String,
model: String,
otr: String,
retailPriceExVAT: String,
actualPrice: String,
p11D: String,
fuelType: String,
transmission: String,
transmissionType: String,
colour: String,
colourCode: String,
colourDescription: String,
commissionNumber: String,
offerAvailable: False,
campaignDiscountOfferTotal: 0,
campaignDiscountOfferTotalCurrent: 0,
campaignDiscountOfferTotalPending: 0,
campaignServiceOfferTotal: 0,
campaignServiceOfferTotalCurrent: 0,
campaignServiceOfferTotalPending: 0,
campaignCustomOfferTotal: 0,
campaignPersonalisedOfferTotalCurrent: 0,
campaignPersonalisedOfferTotalPending: 0,
campaignPersonalisedOfferTotal: 0,
campaignCustomOfferTotalCurrent: 0,
campaignCustomOfferTotalPending: 0,
campaignOtherOfferTotal: 0,
campaignOtherOfferTotalCurrent: 0,
campaignOtherOfferTotalPending: 0,
retailerDiscountOfferTotal: 0,
retailerDiscountOfferTotalCurrent: 0,
retailerDiscountOfferTotalPending: 0,
retailerServiceOfferTotal: 0,
retailerServiceOfferTotalCurrent: 0,
retailerServiceOfferTotalPending: 0,
retailerCustomOfferTotal: 0,
retailerCustomOfferTotalCurrent: 0,
retailerCustomOfferTotalPending: 0,
retailerWarrantyOfferTotal: 0,
retailerWarrantyOfferTotalCurrent: 0,
retailerWarrantyOfferTotalPending: 0,
retailerOfferTotal: 0,
retailerOfferTotalCurrent: 0,
retailerOfferTotalPending: 0,
campaignOfferTotal: 0,
campaignOfferTotalCurrent: 0,
campaignOfferTotalPending: 0,
campaignAndOfferTotal: 0,
campaignAndOfferTotalCurrent: 0,
campaignAndOfferTotalPending: 0,
offerTotal: 0,
offerTotalCurrent: 0,
offerTotalPending: 0,
creation: String,
modified: String,
electricRange: 0,
electricConsumption: 0,
portArrivalDate: 0001-01-01,
daysSincePortArrival: 0,
retailPriceIncVAT: 0,
bodyStyle: String,
upholstery: String,
upholsteryCode: String,
upholsteryType: String,
packageNames:
[
String
],
line: String,
currentRetailerOfferPrice: 0,
retailPrice: String,
vatQualifying: False,
retailerId: 0,
gssnId: String,
noImage: False,
imageUrl: String,
isAvailableOnline: False,
isBackOrdered: False,
creationDate: String,
maintenanceDate: String,
registrationNumber: String,
registrationDate: 0001-01-01,
mileage: 0,
tradeInDate: 0001-01-01,
source: String,
vehicleType: String,
offerAmount: String,
offerExpiry: String,
activeOffers:
[
0
],
campaignMessagesTotal: 0,
underOffer: False,
isDisplayStock: False,
displayRetailer: String,
displayRetailerGssnId: String,
location: String,
account: String,
accountType: String,
usageCode: String,
bm7NST: String,
isSellable: False,
secured: False,
specialist: False,
isMotabilityRetailer: False,
upholsteryDescription: String,
inBackOrderAccount: False,
fullModelYearCode: String,
productionDate: 0001-01-01,
baumuster: String,
isMotability: False,
pipAdvanceRentalGross: 0,
wpmsAdvanceRentalGross: 0,
ispVehicleCustomerDescriptions:
[
String
],
eligibleForMaTransfer: False,
confirmedProductionDate: String,
forecastedArrivalDate: String
},
campaignOffers:
[
{
id: 0,
offerType: String,
campaignName: String,
from: String,
to: String,
value: String,
net: 0,
offerVehicle:
{
retailPriceExVAT: String
},
pending: False,
documentUrl: String,
personalised: False,
isPersonalisedMonetaryOffer: False,
campaignVIPDiscount: False,
offerValueNet: 0,
campaignGovernmentGrant: False
}
],
campaignPersonalisedOffers:
[
{
category: String,
description: String,
reference: String,
campaignId: 0,
certificateRequired: False,
autoSelect: False,
id: 0,
offerType: String,
campaignName: String,
from: String,
to: String,
value: String,
net: 0,
offerVehicle:
{
retailPriceExVAT: String
},
pending: False,
documentUrl: String,
personalised: False,
isPersonalisedMonetaryOffer: False,
campaignVIPDiscount: False,
offerValueNet: 0,
campaignGovernmentGrant: False
}
],
campaignGovernmentGrantOffers:
[
{
id: 0,
offerType: String,
campaignName: String,
from: String,
to: String,
value: String,
net: 0,
offerVehicle:
{
retailPriceExVAT: String
},
pending: False,
documentUrl: String,
personalised: False,
isPersonalisedMonetaryOffer: False,
campaignVIPDiscount: False,
offerValueNet: 0,
campaignGovernmentGrant: False
}
],
campaignMessages:
[
{
id: 0,
vin: String,
campaignId: 0,
value: String,
campaignDescription: String,
from: String,
to: String,
documentUrl: String
}
],
offerHistories:
[
{
id: 0,
auditType: String,
offerType: String,
source: String,
from: String,
to: String,
personalised: False,
value: String,
net: String,
vat: String,
description: String,
vin: String,
gssn: String,
creation: String,
modified: String,
userId: String,
user: 0,
offerId: 0,
commissionNumber: String,
campaignId: 0,
campaignDescription: String,
creationDate: 0001-01-01,
isUsedCarOffer: False
}
],
financeOffers:
[
{
campaignDescription: String,
termsAndConditions: String,
label: String,
campaignId: 0,
documentUrl: String,
from: String,
id: 0,
to: String,
value: String,
vin: String,
enabled: False,
pending: False,
offerType: String
}
]
}