POST | /v1/Used/Vehicle/Upload | Upload used vehicles for VSE processing |
---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
class VehicleValidation implements JsonSerializable
{
public function __construct(
/** @var string */
public string $vin='',
/** @var string */
public string $message='',
/** @var int */
public int $rowIndex=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['vin'])) $this->vin = $o['vin'];
if (isset($o['message'])) $this->message = $o['message'];
if (isset($o['rowIndex'])) $this->rowIndex = $o['rowIndex'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->vin)) $o['vin'] = $this->vin;
if (isset($this->message)) $o['message'] = $this->message;
if (isset($this->rowIndex)) $o['rowIndex'] = $this->rowIndex;
return empty($o) ? new class(){} : $o;
}
}
class VehicleUploadValidationResult implements JsonSerializable
{
public function __construct(
/** @var array<VehicleValidation>|null */
public ?array $valid=null,
/** @var array<VehicleValidation>|null */
public ?array $invalid=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['valid'])) $this->valid = JsonConverters::fromArray('VehicleValidation', $o['valid']);
if (isset($o['invalid'])) $this->invalid = JsonConverters::fromArray('VehicleValidation', $o['invalid']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->valid)) $o['valid'] = JsonConverters::toArray('VehicleValidation', $this->valid);
if (isset($this->invalid)) $o['invalid'] = JsonConverters::toArray('VehicleValidation', $this->invalid);
return empty($o) ? new class(){} : $o;
}
}
class UsedVehicleUploadResponse implements JsonSerializable
{
public function __construct(
/** @var string */
public string $guid='',
/** @var VehicleUploadValidationResult|null */
public ?VehicleUploadValidationResult $vehicles=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['guid'])) $this->guid = $o['guid'];
if (isset($o['vehicles'])) $this->vehicles = JsonConverters::from('VehicleUploadValidationResult', $o['vehicles']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->guid)) $o['guid'] = $this->guid;
if (isset($this->vehicles)) $o['vehicles'] = JsonConverters::to('VehicleUploadValidationResult', $this->vehicles);
return empty($o) ? new class(){} : $o;
}
}
class UsedVehicleUploadRequest implements IPost, JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
PHP UsedVehicleUploadRequest 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/Used/Vehicle/Upload HTTP/1.1
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UsedVehicleUploadRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.VehicleManagement.API.ServiceModel" />
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <UsedVehicleUploadResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.VehicleManagement.API.ServiceModel"> <Guid>00000000-0000-0000-0000-000000000000</Guid> <Vehicles xmlns:d2p1="http://schemas.datacontract.org/2004/07/Mercedes.VehicleManagement.API.Shared.POCO"> <d2p1:Invalid> <d2p1:VehicleValidation> <d2p1:Message>String</d2p1:Message> <d2p1:RowIndex>0</d2p1:RowIndex> <d2p1:VIN>String</d2p1:VIN> </d2p1:VehicleValidation> </d2p1:Invalid> <d2p1:Valid> <d2p1:VehicleValidation> <d2p1:Message>String</d2p1:Message> <d2p1:RowIndex>0</d2p1:RowIndex> <d2p1:VIN>String</d2p1:VIN> </d2p1:VehicleValidation> </d2p1:Valid> </Vehicles> </UsedVehicleUploadResponse>