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 .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/Used/Vehicle/Upload HTTP/1.1
Host: uat-api-vehicle-mgt-mb-dhc.rapp-customers.co.uk
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"guid":"00000000000000000000000000000000","vehicles":{"valid":[{"vin":"String","message":"String","rowIndex":0}],"invalid":[{"vin":"String","message":"String","rowIndex":0}]}}