GET | /v1/{VehicleType}/Vehicle/Motability | Get motability vehicle data |
---|
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 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
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
@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: int = 0
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 VehiclesByRetailerResponse:
vehicles: List[VehicleIdentifierData] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MotabilityVehiclesRequest(IGet):
vehicle_type: Optional[str] = None
Python MotabilityVehiclesRequest 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/Motability 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 { vehicles: [ { 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, 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 ] } ] }