| POST | /quote/order | Provide a quoteId to create an order. This will bill the order to your account. |
|---|
<?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 ApiServiceRequest implements IServiceRequest, IHasApiKey, JsonSerializable
{
public function __construct(
/** @description The API Key required for authentication */
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
/** @var string */
public string $ApiKey=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
return empty($o) ? new class(){} : $o;
}
}
class ApiServiceResponse implements IServiceResponse, JsonSerializable
{
public function __construct(
/** @description Information about the response. */
// @ApiMember(Description="Information about the response.", IsRequired=true)
/** @var string */
public string $Description='',
/** @description Heading or summary of the response. */
// @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
/** @var string */
public string $Heading='',
/** @description Did the intended operation for this response complete successfully? */
// @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
/** @var bool|null */
public ?bool $WasSuccessful=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Heading'])) $this->Heading = $o['Heading'];
if (isset($o['WasSuccessful'])) $this->WasSuccessful = $o['WasSuccessful'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Heading)) $o['Heading'] = $this->Heading;
if (isset($this->WasSuccessful)) $o['WasSuccessful'] = $this->WasSuccessful;
return empty($o) ? new class(){} : $o;
}
}
class PlaceOrderFromQuoteResponse extends ApiServiceResponse implements JsonSerializable
{
/**
* @param string $Description
* @param string $Heading
* @param bool|null $WasSuccessful
*/
public function __construct(
string $Description='',
string $Heading='',
?bool $WasSuccessful=null,
/** @description The ID of the order. */
// @ApiMember(Description="The ID of the order.")
/** @var string */
public string $OrderId='',
/** @description User friendly waybill number */
// @ApiMember(Description="User friendly waybill number")
/** @var string|null */
public ?string $WayBill=null
) {
parent::__construct($Description,$Heading,$WasSuccessful);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['OrderId'])) $this->OrderId = $o['OrderId'];
if (isset($o['WayBill'])) $this->WayBill = $o['WayBill'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->OrderId)) $o['OrderId'] = $this->OrderId;
if (isset($this->WayBill)) $o['WayBill'] = $this->WayBill;
return empty($o) ? new class(){} : $o;
}
}
class PlaceOrderFromQuote extends ApiServiceRequest implements ILogRequest, JsonSerializable
{
/**
* @param string $ApiKey
*/
public function __construct(
string $ApiKey='',
/** @description Optionally provide your own reference identifier */
// @ApiMember(Description="Optionally provide your own reference identifier")
/** @var string|null */
public ?string $ClientReference=null,
/** @description The quote the order is for */
// @ApiMember(Description="The quote the order is for", IsRequired=true)
/** @var string */
public string $QuoteId='',
/** @description Set this to true to prevent creating an order and billing for it */
// @ApiMember(Description="Set this to true to prevent creating an order and billing for it", IsRequired=true)
/** @var bool|null */
public ?bool $Test=null,
/** @description Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent. */
// @ApiMember(Description="Is your account allows Urgent Orders, you can use this flag to indicate when an Order is urgent.")
/** @var bool|null */
public ?bool $IsUrgent=null
) {
parent::__construct($ApiKey);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ClientReference'])) $this->ClientReference = $o['ClientReference'];
if (isset($o['QuoteId'])) $this->QuoteId = $o['QuoteId'];
if (isset($o['Test'])) $this->Test = $o['Test'];
if (isset($o['IsUrgent'])) $this->IsUrgent = $o['IsUrgent'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ClientReference)) $o['ClientReference'] = $this->ClientReference;
if (isset($this->QuoteId)) $o['QuoteId'] = $this->QuoteId;
if (isset($this->Test)) $o['Test'] = $this->Test;
if (isset($this->IsUrgent)) $o['IsUrgent'] = $this->IsUrgent;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /quote/order HTTP/1.1
Host: 1fetch.api.client.prod.86degrees.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"ClientReference":"String","QuoteId":"00000000-0000-0000-0000-000000000000","Test":false,"IsUrgent":false,"ApiKey":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"OrderId":"00000000-0000-0000-0000-000000000000","WayBill":"String","Description":"String","Heading":"String","WasSuccessful":false}