| GET | /v1/{VehicleType}/Vehicle/{vehicleIdentifier} | Get vehicle data by commission number | This endpoint calls Vehicle Data API and returns the data that populates the car details page in OneAdmin |
|---|
#![allow(
dead_code,
non_camel_case_types,
non_snake_case,
clippy::upper_case_acronyms
)]
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct OfferVehicle {
#[serde(rename = "retailPriceExVAT")]
pub retail_price_ex_v_a_t: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct Offer {
pub id: i32,
#[serde(rename = "offerType")]
pub offer_type: String,
#[serde(rename = "campaignName")]
pub campaign_name: String,
pub from: String,
pub to: String,
pub value: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub net: Option<f64>,
#[serde(rename = "offerVehicle")]
pub offer_vehicle: OfferVehicle,
pub pending: bool,
#[serde(rename = "documentUrl")]
pub document_url: String,
pub personalised: bool,
#[serde(rename = "isPersonalisedMonetaryOffer")]
pub is_personalised_monetary_offer: bool,
#[serde(rename = "campaignVIPDiscount")]
pub campaign_v_i_p_discount: bool,
#[serde(rename = "offerValueNet")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub offer_value_net: Option<f64>,
#[serde(rename = "campaignGovernmentGrant")]
pub campaign_government_grant: bool,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct PersonalisedOffer {
#[serde(flatten)]
pub offer: Offer,
pub category: String,
pub description: String,
pub reference: String,
#[serde(rename = "campaignId")]
pub campaign_id: i32,
#[serde(rename = "certificateRequired")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub certificate_required: Option<bool>,
#[serde(rename = "autoSelect")]
pub auto_select: bool,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct Message {
pub id: i32,
pub vin: String,
#[serde(rename = "campaignId")]
pub campaign_id: i32,
pub value: String,
#[serde(rename = "campaignDescription")]
pub campaign_description: String,
pub from: String,
pub to: String,
#[serde(rename = "documentUrl")]
pub document_url: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct OfferHistory {
pub id: i32,
#[serde(rename = "auditType")]
pub audit_type: String,
#[serde(rename = "offerType")]
pub offer_type: String,
pub source: String,
pub from: String,
pub to: String,
pub personalised: bool,
pub value: String,
pub net: String,
pub vat: String,
pub description: String,
pub vin: String,
pub gssn: String,
pub creation: String,
pub modified: String,
#[serde(rename = "userId")]
pub user_id: String,
pub user: i32,
#[serde(rename = "offerId")]
pub offer_id: i32,
#[serde(rename = "commissionNumber")]
pub commission_number: String,
#[serde(rename = "campaignId")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub campaign_id: Option<i32>,
#[serde(rename = "campaignDescription")]
pub campaign_description: String,
#[serde(rename = "creationDate")]
pub creation_date: String,
#[serde(rename = "isUsedCarOffer")]
pub is_used_car_offer: bool,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct FinanceOffer {
#[serde(rename = "campaignDescription")]
pub campaign_description: String,
#[serde(rename = "termsAndConditions")]
pub terms_and_conditions: String,
pub label: String,
#[serde(rename = "campaignId")]
pub campaign_id: i32,
#[serde(rename = "documentUrl")]
pub document_url: String,
pub from: String,
pub id: i32,
pub to: String,
pub value: String,
pub vin: String,
pub enabled: bool,
pub pending: bool,
#[serde(rename = "offerType")]
pub offer_type: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct VehicleByIdentifierResponse {
#[serde(rename = "campaignOffers")]
pub campaign_offers: Vec<Offer>,
#[serde(rename = "campaignPersonalisedOffers")]
pub campaign_personalised_offers: Vec<PersonalisedOffer>,
#[serde(rename = "campaignVoucherOffers")]
pub campaign_voucher_offers: Vec<PersonalisedOffer>,
#[serde(rename = "campaignGovernmentGrantOffers")]
pub campaign_government_grant_offers: Vec<Offer>,
#[serde(rename = "campaignMessages")]
pub campaign_messages: Vec<Message>,
#[serde(rename = "offerHistories")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub offer_histories: Option<Vec<OfferHistory>>,
#[serde(rename = "financeOffers")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub finance_offers: Option<Vec<FinanceOffer>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct VehicleDataBase {
pub vin: String,
pub description: String,
pub model: String,
pub otr: String,
#[serde(rename = "retailPriceExVAT")]
pub retail_price_ex_v_a_t: String,
#[serde(rename = "actualPrice")]
pub actual_price: String,
#[serde(rename = "p11D")]
pub p11_d: String,
#[serde(rename = "fuelType")]
pub fuel_type: String,
pub transmission: String,
#[serde(rename = "transmissionType")]
pub transmission_type: String,
pub colour: String,
#[serde(rename = "colourCode")]
pub colour_code: String,
#[serde(rename = "colourDescription")]
pub colour_description: String,
#[serde(rename = "commissionNumber")]
pub commission_number: String,
#[serde(rename = "offerAvailable")]
pub offer_available: bool,
#[serde(rename = "campaignDiscountOfferTotal")]
pub campaign_discount_offer_total: i32,
#[serde(rename = "campaignDiscountOfferTotalCurrent")]
pub campaign_discount_offer_total_current: i32,
#[serde(rename = "campaignDiscountOfferTotalPending")]
pub campaign_discount_offer_total_pending: i32,
#[serde(rename = "campaignServiceOfferTotal")]
pub campaign_service_offer_total: i32,
#[serde(rename = "campaignServiceOfferTotalCurrent")]
pub campaign_service_offer_total_current: i32,
#[serde(rename = "campaignServiceOfferTotalPending")]
pub campaign_service_offer_total_pending: i32,
#[serde(rename = "campaignCustomOfferTotal")]
pub campaign_custom_offer_total: i32,
#[serde(rename = "campaignPersonalisedOfferTotalCurrent")]
pub campaign_personalised_offer_total_current: i32,
#[serde(rename = "campaignPersonalisedOfferTotalPending")]
pub campaign_personalised_offer_total_pending: i32,
#[serde(rename = "campaignPersonalisedOfferTotal")]
pub campaign_personalised_offer_total: i32,
#[serde(rename = "campaignCustomOfferTotalCurrent")]
pub campaign_custom_offer_total_current: i32,
#[serde(rename = "campaignCustomOfferTotalPending")]
pub campaign_custom_offer_total_pending: i32,
#[serde(rename = "campaignOtherOfferTotal")]
pub campaign_other_offer_total: i32,
#[serde(rename = "campaignOtherOfferTotalCurrent")]
pub campaign_other_offer_total_current: i32,
#[serde(rename = "campaignOtherOfferTotalPending")]
pub campaign_other_offer_total_pending: i32,
#[serde(rename = "retailerDiscountOfferTotal")]
pub retailer_discount_offer_total: i32,
#[serde(rename = "retailerDiscountOfferTotalCurrent")]
pub retailer_discount_offer_total_current: i32,
#[serde(rename = "retailerDiscountOfferTotalPending")]
pub retailer_discount_offer_total_pending: i32,
#[serde(rename = "retailerServiceOfferTotal")]
pub retailer_service_offer_total: i32,
#[serde(rename = "retailerServiceOfferTotalCurrent")]
pub retailer_service_offer_total_current: i32,
#[serde(rename = "retailerServiceOfferTotalPending")]
pub retailer_service_offer_total_pending: i32,
#[serde(rename = "retailerCustomOfferTotal")]
pub retailer_custom_offer_total: i32,
#[serde(rename = "retailerCustomOfferTotalCurrent")]
pub retailer_custom_offer_total_current: i32,
#[serde(rename = "retailerCustomOfferTotalPending")]
pub retailer_custom_offer_total_pending: i32,
#[serde(rename = "retailerWarrantyOfferTotal")]
pub retailer_warranty_offer_total: i32,
#[serde(rename = "retailerWarrantyOfferTotalCurrent")]
pub retailer_warranty_offer_total_current: i32,
#[serde(rename = "retailerWarrantyOfferTotalPending")]
pub retailer_warranty_offer_total_pending: i32,
#[serde(rename = "retailerOfferTotal")]
pub retailer_offer_total: i32,
#[serde(rename = "retailerOfferTotalCurrent")]
pub retailer_offer_total_current: i32,
#[serde(rename = "retailerOfferTotalPending")]
pub retailer_offer_total_pending: i32,
#[serde(rename = "campaignOfferTotal")]
pub campaign_offer_total: i32,
#[serde(rename = "campaignOfferTotalCurrent")]
pub campaign_offer_total_current: i32,
#[serde(rename = "campaignOfferTotalPending")]
pub campaign_offer_total_pending: i32,
#[serde(rename = "campaignAndOfferTotal")]
pub campaign_and_offer_total: i32,
#[serde(rename = "campaignAndOfferTotalCurrent")]
pub campaign_and_offer_total_current: i32,
#[serde(rename = "campaignAndOfferTotalPending")]
pub campaign_and_offer_total_pending: i32,
#[serde(rename = "offerTotal")]
pub offer_total: i32,
#[serde(rename = "offerTotalCurrent")]
pub offer_total_current: i32,
#[serde(rename = "offerTotalPending")]
pub offer_total_pending: i32,
pub creation: String,
pub modified: String,
#[serde(rename = "electricRange")]
pub electric_range: i32,
#[serde(rename = "electricConsumption")]
pub electric_consumption: i32,
#[serde(rename = "portArrivalDate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub port_arrival_date: Option<String>,
#[serde(rename = "daysSincePortArrival")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub days_since_port_arrival: Option<i32>,
#[serde(rename = "retailPriceIncVAT")]
pub retail_price_inc_v_a_t: f64,
#[serde(rename = "bodyStyle")]
pub body_style: String,
pub upholstery: String,
#[serde(rename = "upholsteryCode")]
pub upholstery_code: String,
#[serde(rename = "upholsteryType")]
pub upholstery_type: String,
#[serde(rename = "packageNames")]
pub package_names: Vec<String>,
pub line: String,
#[serde(rename = "mappedLine")]
pub mapped_line: String,
#[serde(rename = "currentRetailerOfferPrice")]
pub current_retailer_offer_price: f64,
#[serde(rename = "retailPrice")]
pub retail_price: String,
#[serde(rename = "vatQualifying")]
pub vat_qualifying: bool,
#[serde(rename = "retailerId")]
pub retailer_id: i32,
#[serde(rename = "gssnId")]
pub gssn_id: String,
#[serde(rename = "noImage")]
pub no_image: bool,
#[serde(rename = "imageUrl")]
pub image_url: String,
#[serde(rename = "isAvailableOnline")]
pub is_available_online: bool,
#[serde(rename = "isBackOrdered")]
pub is_back_ordered: bool,
#[serde(rename = "creationDate")]
pub creation_date: String,
#[serde(rename = "maintenanceDate")]
pub maintenance_date: String,
#[serde(rename = "registrationNumber")]
pub registration_number: String,
#[serde(rename = "registrationDate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub registration_date: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mileage: Option<i32>,
#[serde(rename = "tradeInDate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub trade_in_date: Option<String>,
pub source: String,
#[serde(rename = "vehicleType")]
pub vehicle_type: String,
#[serde(rename = "offerAmount")]
pub offer_amount: String,
#[serde(rename = "offerExpiry")]
pub offer_expiry: String,
#[serde(rename = "activeOffers")]
pub active_offers: Vec<i32>,
#[serde(rename = "campaignMessagesTotal")]
pub campaign_messages_total: i32,
#[serde(rename = "underOffer")]
pub under_offer: bool,
#[serde(rename = "isDisplayStock")]
pub is_display_stock: bool,
#[serde(rename = "displayRetailer")]
pub display_retailer: String,
#[serde(rename = "displayRetailerGssnId")]
pub display_retailer_gssn_id: String,
pub location: String,
pub account: String,
#[serde(rename = "accountType")]
pub account_type: String,
#[serde(rename = "usageCode")]
pub usage_code: String,
#[serde(rename = "bm7NST")]
pub bm7_n_s_t: String,
#[serde(rename = "isSellable")]
pub is_sellable: bool,
pub secured: bool,
pub specialist: bool,
#[serde(rename = "isMotabilityRetailer")]
pub is_motability_retailer: bool,
#[serde(rename = "upholsteryDescription")]
pub upholstery_description: String,
#[serde(rename = "inBackOrderAccount")]
pub in_back_order_account: bool,
#[serde(rename = "fullModelYearCode")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub full_model_year_code: Option<String>,
pub baumuster: String,
#[serde(rename = "isMotability")]
pub is_motability: bool,
#[serde(rename = "pipAdvanceRentalGross")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pip_advance_rental_gross: Option<f64>,
#[serde(rename = "wpmsAdvanceRentalGross")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub wpms_advance_rental_gross: Option<f64>,
#[serde(rename = "ispVehicleCustomerDescriptions")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub isp_vehicle_customer_descriptions: Option<Vec<String>>,
#[serde(rename = "eligibleForMaTransfer")]
pub eligible_for_ma_transfer: bool,
#[serde(rename = "confirmedProductionDate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub confirmed_production_date: Option<String>,
#[serde(rename = "forecastedArrivalDate")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub forecasted_arrival_date: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct VehicleData {
#[serde(flatten)]
pub vehicle_data_base: VehicleDataBase,
pub engine: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct Equipment {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<i32>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct VehicleIdentifierData {
#[serde(flatten)]
pub vehicle_data: VehicleData,
pub retailer: String,
#[serde(rename = "hasMotabilityError")]
pub has_motability_error: bool,
pub equipment: Vec<Equipment>,
#[serde(rename = "vehicleClass")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub vehicle_class: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct VehicleByCommissionNumberResponse {
#[serde(flatten)]
pub vehicle_by_identifier_response: VehicleByIdentifierResponse,
pub vehicle: VehicleIdentifierData,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct VehicleByCommissionNumberRequest {
#[serde(rename = "vehicleIdentifier")]
pub vehicle_identifier: String,
#[serde(rename = "vehicleType")]
pub vehicle_type: String,
}
Rust VehicleByCommissionNumberRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
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/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"vehicle":{"retailer":"String","hasMotabilityError":false,"equipment":[{"id":0,"code":"String","description":"String"}],"vehicleClass":"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":"\/Date(-62135596800000-0000)\/","daysSincePortArrival":0,"retailPriceIncVAT":0,"bodyStyle":"String","upholstery":"String","upholsteryCode":"String","upholsteryType":"String","packageNames":["String"],"line":"String","mappedLine":"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":"\/Date(-62135596800000-0000)\/","mileage":0,"tradeInDate":"\/Date(-62135596800000-0000)\/","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","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}],"campaignVoucherOffers":[{"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":"\/Date(-62135596800000-0000)\/","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"}]}