POST | /v1/configurator | Validate and save a car configurator code for a back order | This endpoint calls Agency API to validate and save a car configurator code for a back order. The code is validated and saved in the database and returns a response from a third party CCS which provides car configuration details. These get saved to open search and returned to the front-end |
---|
import 'package:servicestack/servicestack.dart';
class KeyInformation implements IConvertible
{
String? BM7NST;
String? ConfigurationDate;
String? ModelYear;
String? HalfYear;
KeyInformation({this.BM7NST,this.ConfigurationDate,this.ModelYear,this.HalfYear});
KeyInformation.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
BM7NST = json['BM7NST'];
ConfigurationDate = json['ConfigurationDate'];
ModelYear = json['ModelYear'];
HalfYear = json['HalfYear'];
return this;
}
Map<String, dynamic> toJson() => {
'BM7NST': BM7NST,
'ConfigurationDate': ConfigurationDate,
'ModelYear': ModelYear,
'HalfYear': HalfYear
};
getTypeName() => "KeyInformation";
TypeContext? context = _ctx;
}
class OrderingOptions implements IConvertible
{
List<String>? Interior;
List<String>? Exterior;
List<String>? Other;
OrderingOptions({this.Interior,this.Exterior,this.Other});
OrderingOptions.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Interior = JsonConverters.fromJson(json['Interior'],'List<String>',context!);
Exterior = JsonConverters.fromJson(json['Exterior'],'List<String>',context!);
Other = JsonConverters.fromJson(json['Other'],'List<String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Interior': JsonConverters.toJson(Interior,'List<String>',context!),
'Exterior': JsonConverters.toJson(Exterior,'List<String>',context!),
'Other': JsonConverters.toJson(Other,'List<String>',context!)
};
getTypeName() => "OrderingOptions";
TypeContext? context = _ctx;
}
class CarConfiguratorResponse implements IConvertible
{
String? Name;
KeyInformation? KeyInformation;
OrderingOptions? OrderingOptions;
ResponseStatus? ResponseStatus;
String? ConfiguratorCode;
CarConfiguratorResponse({this.Name,this.KeyInformation,this.OrderingOptions,this.ResponseStatus,this.ConfiguratorCode});
CarConfiguratorResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Name = json['Name'];
KeyInformation = JsonConverters.fromJson(json['KeyInformation'],'KeyInformation',context!);
OrderingOptions = JsonConverters.fromJson(json['OrderingOptions'],'OrderingOptions',context!);
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
ConfiguratorCode = json['ConfiguratorCode'];
return this;
}
Map<String, dynamic> toJson() => {
'Name': Name,
'KeyInformation': JsonConverters.toJson(KeyInformation,'KeyInformation',context!),
'OrderingOptions': JsonConverters.toJson(OrderingOptions,'OrderingOptions',context!),
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
'ConfiguratorCode': ConfiguratorCode
};
getTypeName() => "CarConfiguratorResponse";
TypeContext? context = _ctx;
}
class CarConfiguratorRequest implements IPost, IConvertible
{
/**
* Configurator code
*/
// @ApiMember(Description="Configurator code", IsRequired=true)
String? ConfiguratorCode;
CarConfiguratorRequest({this.ConfiguratorCode});
CarConfiguratorRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ConfiguratorCode = json['ConfiguratorCode'];
return this;
}
Map<String, dynamic> toJson() => {
'ConfiguratorCode': ConfiguratorCode
};
getTypeName() => "CarConfiguratorRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'prod_api_agency_orch_mb_dhc.rapp_customers.co.uk', types: <String, TypeInfo> {
'KeyInformation': TypeInfo(TypeOf.Class, create:() => KeyInformation()),
'OrderingOptions': TypeInfo(TypeOf.Class, create:() => OrderingOptions()),
'CarConfiguratorResponse': TypeInfo(TypeOf.Class, create:() => CarConfiguratorResponse()),
'CarConfiguratorRequest': TypeInfo(TypeOf.Class, create:() => CarConfiguratorRequest()),
});
Dart CarConfiguratorRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/configurator HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CarConfiguratorRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.Orchestration.API.ServiceModel.BackOrders">
<ConfiguratorCode>String</ConfiguratorCode>
</CarConfiguratorRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CarConfiguratorResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Agency.API.Shared.POCO.CarConfigurator"> <ConfiguratorCode>String</ConfiguratorCode> <KeyInformation> <BM7NST>String</BM7NST> <ConfigurationDate>String</ConfigurationDate> <HalfYear>String</HalfYear> <ModelYear>String</ModelYear> </KeyInformation> <Name>String</Name> <OrderingOptions> <Exterior xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:string>String</d3p1:string> </Exterior> <Interior xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:string>String</d3p1:string> </Interior> <Other xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:string>String</d3p1:string> </Other> </OrderingOptions> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> </CarConfiguratorResponse>