POST | /v1/{VehicleType}/Vehicle/CentralCsv | Filter central vehicle data for CSV |
---|
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 CsvVehicleData:
commission_number: Optional[str] = None
retailer: Optional[str] = None
description: Optional[str] = None
model: Optional[str] = None
colour: Optional[str] = None
fuel_type: Optional[str] = None
transmission: Optional[str] = None
otr: Optional[str] = None
days_since_port_arrival: Optional[int] = None
offer_amount: Optional[str] = None
offer_expiry: Optional[str] = None
active_offers: List[str] = field(default_factory=list)
modified: Optional[str] = None
retail_price: Optional[str] = None
vin: Optional[str] = None
electric_range: int = 0
electric_consumption: int = 0
campaign_messages_total: int = 0
campaign_personalised_offer_total: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CentralStockResponse:
vehicles: Optional[List[CsvVehicleData]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CentralVehiclesCsvRequest(IPost):
min: int = 0
max: int = 0
no_port_arrival_date: bool = False
vehicle_type: Optional[str] = None
Python CentralVehiclesCsvRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/{VehicleType}/Vehicle/CentralCsv HTTP/1.1
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"min":0,"max":0,"noPortArrivalDate":false,"vehicleType":"String"}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {}