POST | /v1/vehicle | Get Vehicle by Vin |
---|
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 GetVehicleRequest:
vin: Optional[str] = None
include_allocated_to_order: bool = False
gssn: Optional[str] = None
is_one_admin: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Model:
id: int = 0
description: Optional[str] = None
display_name: Optional[str] = None
image_url_small: Optional[str] = None
image_url_medium: Optional[str] = None
image_url_large: Optional[str] = None
specialist: bool = False
priority: int = 0
exclude_from_online_showroom_filters: Optional[bool] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BodyStyle:
id: int = 0
description: Optional[str] = None
models: Optional[List[Model]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Brand:
id: int = 0
description: Optional[str] = None
display_name: Optional[str] = None
body_styles: Optional[List[BodyStyle]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Engine:
id: Optional[int] = None
badge: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Media:
no_image: bool = False
main_image_url: Optional[str] = None
class OfferPriceProductType(str, Enum):
LIS_T__P_R_I_C_E = 'LIST_PRICE'
NUMBE_R__P_L_A_T_E__F_E_E = 'NUMBER_PLATE_FEE'
DELIVER_Y__C_H_A_R_G_E = 'DELIVERY_CHARGE'
FUE_L__C_H_A_R_G_E = 'FUEL_CHARGE'
MANUFACTURE_R__O_F_F_E_R = 'MANUFACTURER_OFFER'
PERSONALISE_D__M_O_N_E_Y_O_F_F_E_R = 'PERSONALISED_MONEYOFFER'
PERSONALISE_D__N_O_N_M_O_N_E_Y_O_F_F_E_R = 'PERSONALISED_NONMONEYOFFER'
PERSONALISE_D__N_O_N_M_O_N_E_Y_O_F_F_E_R__N_E_G = 'PERSONALISED_NONMONEYOFFER_NEG'
SERVICE = 'SERVICE'
SERVIC_E__N_E_G = 'SERVICE_NEG'
GOVERNMEN_T__G_R_A_N_T = 'GOVERNMENT_GRANT'
OUTRIGH_T__P_U_R_C_H_A_S_E__D_I_S_C_O_U_N_T = 'OUTRIGHT_PURCHASE_DISCOUNT'
VI_P__O_F_F_E_R = 'VIP_OFFER'
WALLBO_X__O_F_F_E_R = 'WALLBOX_OFFER'
WALLBO_X__O_F_F_E_R__N_E_G = 'WALLBOX_OFFER_NEG'
ROA_D__F_U_N_D__L_I_C_E_N_C_E = 'ROAD_FUND_LICENCE'
FIRS_T__R_E_G_I_S_T_R_A_T_I_O_N__F_E_E = 'FIRST_REGISTRATION_FEE'
NO_T__F_O_U_N_D = 'NOT_FOUND'
ACCESSOR_Y__O_F_F_E_R = 'ACCESSORY_OFFER'
ACCESSOR_Y__O_F_F_E_R__N_E_G = 'ACCESSORY_OFFER_NEG'
MOTABILIT_Y__D_I_S_C_O_U_N_T = 'MOTABILITY_DISCOUNT'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Price:
id: Optional[str] = None
description: Optional[str] = None
net: Decimal = decimal.Decimal(0)
vat: Decimal = decimal.Decimal(0)
gross: Decimal = decimal.Decimal(0)
product: Optional[OfferPriceProductType] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RetailerOpeningTime:
day: Optional[str] = None
open_from: Optional[str] = None
open_to: Optional[str] = None
special: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RetailerOpeningTimes:
new: List[RetailerOpeningTime] = field(default_factory=list)
used: List[RetailerOpeningTime] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Retailer:
id: int = 0
gssn_id: Optional[str] = None
description: Optional[str] = None
street: Optional[str] = None
city: Optional[str] = None
postcode: Optional[str] = None
google_map_postcode: Optional[str] = None
phone: Optional[str] = None
fax: Optional[str] = None
email: Optional[str] = None
website: Optional[str] = None
retailer_group_id: Optional[str] = None
retailer_group_name: Optional[str] = None
is_online: bool = False
is_new_car_retailer: bool = False
is_used_car_retailer: bool = False
is_central_retailer: bool = False
chat_enabled: bool = False
trade_in_enabled: bool = False
smart: bool = False
display_phone_number_new: Optional[str] = None
display_phone_number_used: Optional[str] = None
latitude: Decimal = decimal.Decimal(0)
longitude: Decimal = decimal.Decimal(0)
smart_description: Optional[str] = None
smart_website: Optional[str] = None
smart_phone: Optional[str] = None
legacy_id: Optional[str] = None
agent: bool = False
market_area_id: int = 0
digital_lounge_parent_gssn_id: Optional[str] = None
send_leads_to_digital_lounge_parent: bool = False
opening_times: Optional[RetailerOpeningTimes] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleConsumption:
id: int = 0
lkm: Decimal = decimal.Decimal(0)
mpg: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Equipment:
id: int = 0
code: Optional[str] = None
description: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Equipmentv2(Equipment):
importance: int = 0
is_additional: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleEquipmentCategory:
order: int = 0
code: Optional[str] = None
description: Optional[str] = None
equipment: Optional[List[Equipmentv2]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleEmissionClass:
colour: Optional[str] = None
rating: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleAttribute:
description: Optional[str] = None
value: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleIntegratedServiceCareOption:
option_code: Optional[str] = None
b_m7_n_s_t: Optional[str] = None
full_model_year: Optional[str] = None
integrated_product_type: Optional[str] = None
customer_description: Optional[str] = None
one_agent_product_type: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleDetailDto:
body_style: Optional[str] = None
vin: Optional[str] = None
description: Optional[str] = None
colour: Optional[str] = None
colour_code: Optional[str] = None
colour_description: Optional[str] = None
colour_group: Optional[str] = None
model: Optional[str] = None
commission_number: Optional[str] = None
brand_id: Optional[int] = None
brand: Optional[Brand] = None
engine: Optional[Engine] = None
engine_badge: Optional[str] = None
media: Optional[Media] = None
line: Optional[str] = None
upholstery_code: Optional[str] = None
upholstery_type: Optional[str] = None
upholstery: Optional[str] = None
upholstery_description: Optional[str] = None
available_packages: List[str] = field(default_factory=list)
packages: List[str] = field(default_factory=list)
p11_d: Decimal = decimal.Decimal(0)
port_arrival_date: Optional[datetime.datetime] = None
prices: List[Price] = field(default_factory=list)
transmission_type: Optional[str] = None
fuel_type: Optional[str] = None
vehicle_class: Optional[str] = None
product_range: Optional[str] = None
vehicle_type: Optional[str] = None
emission: Optional[Decimal] = None
is_available_online: bool = False
under_offer: bool = False
is_excluded: bool = False
is_sellable: bool = False
on_hold: bool = False
electric_consumption: Optional[Decimal] = None
electric_range: Optional[Decimal] = None
image_url: Optional[str] = None
baumuster: Optional[str] = None
retailer: Optional[Retailer] = None
bm7_n_s_t: Optional[str] = None
otr: Decimal = decimal.Decimal(0)
actual_price: Decimal = decimal.Decimal(0)
is_display_stock: bool = False
display_retailer_id: Optional[int] = None
display_retailer: Optional[str] = None
display_retailer_gssn_id: Optional[str] = None
display_retailer_market_area_id: Optional[str] = None
is_smart_display_retailer: bool = False
is_specialist_car: bool = False
age: Optional[int] = None
secured: bool = False
is_h_o_back_order_account_vehicle: bool = False
is_allocated_to_back_order: bool = False
usage_code: Optional[str] = None
emission_combined: Optional[Decimal] = None
normalised_emission_directive: Optional[str] = None
has_mild_hybrid_equipment_code: bool = False
retail_price_ex_vat: Decimal = decimal.Decimal(0)
retail_price__inc_v_a_t: Decimal = decimal.Decimal(0)
retail_price__ex_v_a_t: Decimal = decimal.Decimal(0)
model_id: int = 0
vid: Optional[str] = None
production_date: Optional[str] = None
full_model_year_code: Optional[str] = None
chassis_number: Optional[str] = None
eligible_for_integrated_service_care: bool = False
account_type: Optional[str] = None
consumption_combined: Optional[VehicleConsumption] = None
consumption_extra_urban: Optional[VehicleConsumption] = None
consumption_urban: Optional[VehicleConsumption] = None
wltp_fuel_consumption_combined: Optional[VehicleConsumption] = None
wltp_fuel_consumption_extra_high: Optional[VehicleConsumption] = None
wltp_fuel_consumption_high: Optional[VehicleConsumption] = None
wltp_fuel_consumption_low: Optional[VehicleConsumption] = None
wltp_fuel_consumption_medium: Optional[VehicleConsumption] = None
equipment: Optional[List[Equipmentv2]] = None
equipment_categories: Optional[List[VehicleEquipmentCategory]] = None
energy_efficiency_class: Optional[VehicleEmissionClass] = None
vehicle_data: Optional[List[VehicleAttribute]] = None
integrated_service_care_options: List[VehicleIntegratedServiceCareOption] = field(default_factory=list)
isp_vehicle_customer_descriptions: Optional[List[str]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class VehicleError:
field: Optional[str] = None
message: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetVehicleResponse:
vehicle: Optional[VehicleDetailDto] = None
errors: List[VehicleError] = field(default_factory=list)
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.
POST /v1/vehicle HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Vin: String,
IncludeAllocatedToOrder: False,
Gssn: String,
IsOneAdmin: False
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Vehicle: { BodyStyle: String, Vin: String, Description: String, Colour: String, ColourCode: String, ColourDescription: String, ColourGroup: String, Model: String, CommissionNumber: String, BrandId: 0, Brand: { Id: 0, Description: String, DisplayName: String, BodyStyles: [ { Id: 0, Description: String, Models: [ { Id: 0, Description: String, DisplayName: String, ImageUrlSmall: String, ImageUrlMedium: String, ImageUrlLarge: String, Specialist: False, Priority: 0, ExcludeFromOnlineShowroomFilters: False } ] } ] }, Engine: { Id: 0, Badge: String }, EngineBadge: String, Media: { NoImage: False, MainImageUrl: String }, Line: String, UpholsteryCode: String, UpholsteryType: String, Upholstery: String, UpholsteryDescription: String, AvailablePackages: [ String ], Packages: [ String ], P11D: 0, PortArrivalDate: 0001-01-01, Prices: [ { Id: String, Description: String, Net: 0, VAT: 0, Gross: 0, Product: LIST_PRICE } ], TransmissionType: String, FuelType: String, VehicleClass: String, ProductRange: String, VehicleType: String, Emission: 0, IsAvailableOnline: False, UnderOffer: False, IsExcluded: False, IsSellable: False, OnHold: False, ElectricConsumption: 0, ElectricRange: 0, ImageUrl: String, Baumuster: String, Retailer: { Id: 0, GssnId: String, Description: String, Street: String, City: String, Postcode: String, GoogleMapPostcode: String, Phone: String, Fax: String, Email: String, Website: String, RetailerGroupId: String, RetailerGroupName: String, IsOnline: False, IsNewCarRetailer: False, IsUsedCarRetailer: False, IsCentralRetailer: False, ChatEnabled: False, TradeInEnabled: False, smart: False, DisplayPhoneNumberNew: String, DisplayPhoneNumberUsed: String, Latitude: 0, Longitude: 0, smartDescription: String, smartWebsite: String, smartPhone: String, LegacyId: String, Agent: False, MarketAreaId: 0, DigitalLoungeParentGssnId: String, SendLeadsToDigitalLoungeParent: False, OpeningTimes: { New: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ], Used: [ { Day: String, OpenFrom: String, OpenTo: String, Special: String } ] } }, Bm7NST: String, OTR: 0, ActualPrice: 0, IsDisplayStock: False, DisplayRetailerId: 0, DisplayRetailer: String, DisplayRetailerGssnId: String, DisplayRetailerMarketAreaId: String, IsSmartDisplayRetailer: False, IsSpecialistCar: False, Age: 0, Secured: False, IsHOBackOrderAccountVehicle: False, IsAllocatedToBackOrder: False, UsageCode: String, EmissionCombined: 0, NormalisedEmissionDirective: String, HasMildHybridEquipmentCode: False, RetailPriceExVat: 0, RetailPrice_IncVAT: 0, RetailPrice_ExVAT: 0, ModelId: 0, VID: String, ProductionDate: String, FullModelYearCode: String, ChassisNumber: String, EligibleForIntegratedServiceCare: False, AccountType: String, ConsumptionCombined: { Id: 0, Lkm: 0, Mpg: 0 }, ConsumptionExtraUrban: { Id: 0, Lkm: 0, Mpg: 0 }, ConsumptionUrban: { Id: 0, Lkm: 0, Mpg: 0 }, WltpFuelConsumptionCombined: { Id: 0, Lkm: 0, Mpg: 0 }, WltpFuelConsumptionExtraHigh: { Id: 0, Lkm: 0, Mpg: 0 }, WltpFuelConsumptionHigh: { Id: 0, Lkm: 0, Mpg: 0 }, WltpFuelConsumptionLow: { Id: 0, Lkm: 0, Mpg: 0 }, WltpFuelConsumptionMedium: { Id: 0, Lkm: 0, Mpg: 0 }, Equipment: [ { Importance: 0, IsAdditional: False, Id: 0, Code: String, Description: String } ], EquipmentCategories: [ { Order: 0, Code: String, Description: String, Equipment: [ { Importance: 0, IsAdditional: False, Id: 0, Code: String, Description: String } ] } ], EnergyEfficiencyClass: { Colour: String, Rating: String }, VehicleData: [ { Description: String, Value: String } ], IntegratedServiceCareOptions: [ { OptionCode: String, BM7NST: String, FullModelYear: String, IntegratedProductType: String, CustomerDescription: String, OneAgentProductType: String } ], IspVehicleCustomerDescriptions: [ String ] }, Errors: [ { Field: String, Message: String } ] }