Trendsic Platform Service

<back to all web services

DispatchRequestAcceptRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dispatch/requests/{RequestId}/accept
<?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 DispatchRequestEventView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $EventId=0,
        /** @var string|null */
        public ?string $Kind=null,
        /** @var string|null */
        public ?string $Detail=null,
        /** @var DateTime */
        public DateTime $AtUtc=new DateTime(),
        /** @var string|null */
        public ?string $ByWho=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['EventId'])) $this->EventId = $o['EventId'];
        if (isset($o['Kind'])) $this->Kind = $o['Kind'];
        if (isset($o['Detail'])) $this->Detail = $o['Detail'];
        if (isset($o['AtUtc'])) $this->AtUtc = JsonConverters::from('DateTime', $o['AtUtc']);
        if (isset($o['ByWho'])) $this->ByWho = $o['ByWho'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->EventId)) $o['EventId'] = $this->EventId;
        if (isset($this->Kind)) $o['Kind'] = $this->Kind;
        if (isset($this->Detail)) $o['Detail'] = $this->Detail;
        if (isset($this->AtUtc)) $o['AtUtc'] = JsonConverters::to('DateTime', $this->AtUtc);
        if (isset($this->ByWho)) $o['ByWho'] = $this->ByWho;
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchRequestView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $RequestId=0,
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $CustomerName=null,
        /** @var string|null */
        public ?string $CustomerPhone=null,
        /** @var string|null */
        public ?string $CustomerEmail=null,
        /** @var string|null */
        public ?string $Cargo=null,
        /** @var int */
        public int $Units=0,
        /** @var string|null */
        public ?string $FromLoc=null,
        /** @var string|null */
        public ?string $ToLoc=null,
        /** @var int|null */
        public ?int $Miles=null,
        /** @var string|null */
        public ?string $WindowText=null,
        /** @var bool|null */
        public ?bool $IsUrgent=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var string|null */
        public ?string $Source=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $RequiredRig=null,
        /** @var int|null */
        public ?int $UnitsPerTruck=null,
        /** @var float|null */
        public ?float $RatePerLoad=null,
        /** @var float */
        public float $UrgencyPct=0.0,
        /** @var float|null */
        public ?float $CostPerLoad=null,
        /** @var int|null */
        public ?int $LoadsNeeded=null,
        /** @var float|null */
        public ?float $QuoteTotal=null,
        /** @var int */
        public int $QuoteVersion=0,
        /** @var DateTime|null */
        public ?DateTime $QuotedUtc=null,
        /** @var string|null */
        public ?string $QuotedBy=null,
        /** @var DateTime|null */
        public ?DateTime $AcceptTokenExpiresUtc=null,
        /** @var DateTime|null */
        public ?DateTime $AcceptedUtc=null,
        /** @var string|null */
        public ?string $AcceptedVia=null,
        /** @var DateTime|null */
        public ?DateTime $DeclinedUtc=null,
        /** @var string|null */
        public ?string $DeclinedBy=null,
        /** @var string|null */
        public ?string $DeclineReason=null,
        /** @var int */
        public int $JobsCreated=0,
        /** @var int */
        public int $JobsDone=0,
        /** @var int */
        public int $JobsNeedDriver=0,
        /** @var DateTime */
        public DateTime $CreatedUtc=new DateTime(),
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var array<DispatchRequestEventView>|null */
        public ?array $Events=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['RequestId'])) $this->RequestId = $o['RequestId'];
        if (isset($o['Code'])) $this->Code = $o['Code'];
        if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
        if (isset($o['CustomerPhone'])) $this->CustomerPhone = $o['CustomerPhone'];
        if (isset($o['CustomerEmail'])) $this->CustomerEmail = $o['CustomerEmail'];
        if (isset($o['Cargo'])) $this->Cargo = $o['Cargo'];
        if (isset($o['Units'])) $this->Units = $o['Units'];
        if (isset($o['FromLoc'])) $this->FromLoc = $o['FromLoc'];
        if (isset($o['ToLoc'])) $this->ToLoc = $o['ToLoc'];
        if (isset($o['Miles'])) $this->Miles = $o['Miles'];
        if (isset($o['WindowText'])) $this->WindowText = $o['WindowText'];
        if (isset($o['IsUrgent'])) $this->IsUrgent = $o['IsUrgent'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['Source'])) $this->Source = $o['Source'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['RequiredRig'])) $this->RequiredRig = $o['RequiredRig'];
        if (isset($o['UnitsPerTruck'])) $this->UnitsPerTruck = $o['UnitsPerTruck'];
        if (isset($o['RatePerLoad'])) $this->RatePerLoad = $o['RatePerLoad'];
        if (isset($o['UrgencyPct'])) $this->UrgencyPct = $o['UrgencyPct'];
        if (isset($o['CostPerLoad'])) $this->CostPerLoad = $o['CostPerLoad'];
        if (isset($o['LoadsNeeded'])) $this->LoadsNeeded = $o['LoadsNeeded'];
        if (isset($o['QuoteTotal'])) $this->QuoteTotal = $o['QuoteTotal'];
        if (isset($o['QuoteVersion'])) $this->QuoteVersion = $o['QuoteVersion'];
        if (isset($o['QuotedUtc'])) $this->QuotedUtc = JsonConverters::from('DateTime', $o['QuotedUtc']);
        if (isset($o['QuotedBy'])) $this->QuotedBy = $o['QuotedBy'];
        if (isset($o['AcceptTokenExpiresUtc'])) $this->AcceptTokenExpiresUtc = JsonConverters::from('DateTime', $o['AcceptTokenExpiresUtc']);
        if (isset($o['AcceptedUtc'])) $this->AcceptedUtc = JsonConverters::from('DateTime', $o['AcceptedUtc']);
        if (isset($o['AcceptedVia'])) $this->AcceptedVia = $o['AcceptedVia'];
        if (isset($o['DeclinedUtc'])) $this->DeclinedUtc = JsonConverters::from('DateTime', $o['DeclinedUtc']);
        if (isset($o['DeclinedBy'])) $this->DeclinedBy = $o['DeclinedBy'];
        if (isset($o['DeclineReason'])) $this->DeclineReason = $o['DeclineReason'];
        if (isset($o['JobsCreated'])) $this->JobsCreated = $o['JobsCreated'];
        if (isset($o['JobsDone'])) $this->JobsDone = $o['JobsDone'];
        if (isset($o['JobsNeedDriver'])) $this->JobsNeedDriver = $o['JobsNeedDriver'];
        if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['Events'])) $this->Events = JsonConverters::fromArray('DispatchRequestEventView', $o['Events']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->RequestId)) $o['RequestId'] = $this->RequestId;
        if (isset($this->Code)) $o['Code'] = $this->Code;
        if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
        if (isset($this->CustomerPhone)) $o['CustomerPhone'] = $this->CustomerPhone;
        if (isset($this->CustomerEmail)) $o['CustomerEmail'] = $this->CustomerEmail;
        if (isset($this->Cargo)) $o['Cargo'] = $this->Cargo;
        if (isset($this->Units)) $o['Units'] = $this->Units;
        if (isset($this->FromLoc)) $o['FromLoc'] = $this->FromLoc;
        if (isset($this->ToLoc)) $o['ToLoc'] = $this->ToLoc;
        if (isset($this->Miles)) $o['Miles'] = $this->Miles;
        if (isset($this->WindowText)) $o['WindowText'] = $this->WindowText;
        if (isset($this->IsUrgent)) $o['IsUrgent'] = $this->IsUrgent;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->Source)) $o['Source'] = $this->Source;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->RequiredRig)) $o['RequiredRig'] = $this->RequiredRig;
        if (isset($this->UnitsPerTruck)) $o['UnitsPerTruck'] = $this->UnitsPerTruck;
        if (isset($this->RatePerLoad)) $o['RatePerLoad'] = $this->RatePerLoad;
        if (isset($this->UrgencyPct)) $o['UrgencyPct'] = $this->UrgencyPct;
        if (isset($this->CostPerLoad)) $o['CostPerLoad'] = $this->CostPerLoad;
        if (isset($this->LoadsNeeded)) $o['LoadsNeeded'] = $this->LoadsNeeded;
        if (isset($this->QuoteTotal)) $o['QuoteTotal'] = $this->QuoteTotal;
        if (isset($this->QuoteVersion)) $o['QuoteVersion'] = $this->QuoteVersion;
        if (isset($this->QuotedUtc)) $o['QuotedUtc'] = JsonConverters::to('DateTime', $this->QuotedUtc);
        if (isset($this->QuotedBy)) $o['QuotedBy'] = $this->QuotedBy;
        if (isset($this->AcceptTokenExpiresUtc)) $o['AcceptTokenExpiresUtc'] = JsonConverters::to('DateTime', $this->AcceptTokenExpiresUtc);
        if (isset($this->AcceptedUtc)) $o['AcceptedUtc'] = JsonConverters::to('DateTime', $this->AcceptedUtc);
        if (isset($this->AcceptedVia)) $o['AcceptedVia'] = $this->AcceptedVia;
        if (isset($this->DeclinedUtc)) $o['DeclinedUtc'] = JsonConverters::to('DateTime', $this->DeclinedUtc);
        if (isset($this->DeclinedBy)) $o['DeclinedBy'] = $this->DeclinedBy;
        if (isset($this->DeclineReason)) $o['DeclineReason'] = $this->DeclineReason;
        if (isset($this->JobsCreated)) $o['JobsCreated'] = $this->JobsCreated;
        if (isset($this->JobsDone)) $o['JobsDone'] = $this->JobsDone;
        if (isset($this->JobsNeedDriver)) $o['JobsNeedDriver'] = $this->JobsNeedDriver;
        if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->Events)) $o['Events'] = JsonConverters::toArray('DispatchRequestEventView', $this->Events);
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchRigCountView implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $RigType=null,
        /** @var int */
        public int $Rigs=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['RigType'])) $this->RigType = $o['RigType'];
        if (isset($o['Rigs'])) $this->Rigs = $o['Rigs'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->RigType)) $o['RigType'] = $this->RigType;
        if (isset($this->Rigs)) $o['Rigs'] = $this->Rigs;
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchCarrierPickView implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $VendorID=0,
        /** @var string|null */
        public ?string $VendorName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['VendorID'])) $this->VendorID = $o['VendorID'];
        if (isset($o['VendorName'])) $this->VendorName = $o['VendorName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->VendorID)) $o['VendorID'] = $this->VendorID;
        if (isset($this->VendorName)) $o['VendorName'] = $this->VendorName;
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchRequestsResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<DispatchRequestView>|null */
        public ?array $Requests=null,
        /** @var DispatchRequestView|null */
        public ?DispatchRequestView $Request=null,
        /** @var array<DispatchRigCountView>|null */
        public ?array $RigCounts=null,
        /** @var array<DispatchCarrierPickView>|null */
        public ?array $Carriers=null,
        /** @var string|null */
        public ?string $QuoteLink=null,
        /** @var string|null */
        public ?string $Delivery=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Requests'])) $this->Requests = JsonConverters::fromArray('DispatchRequestView', $o['Requests']);
        if (isset($o['Request'])) $this->Request = JsonConverters::from('DispatchRequestView', $o['Request']);
        if (isset($o['RigCounts'])) $this->RigCounts = JsonConverters::fromArray('DispatchRigCountView', $o['RigCounts']);
        if (isset($o['Carriers'])) $this->Carriers = JsonConverters::fromArray('DispatchCarrierPickView', $o['Carriers']);
        if (isset($o['QuoteLink'])) $this->QuoteLink = $o['QuoteLink'];
        if (isset($o['Delivery'])) $this->Delivery = $o['Delivery'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Requests)) $o['Requests'] = JsonConverters::toArray('DispatchRequestView', $this->Requests);
        if (isset($this->Request)) $o['Request'] = JsonConverters::to('DispatchRequestView', $this->Request);
        if (isset($this->RigCounts)) $o['RigCounts'] = JsonConverters::toArray('DispatchRigCountView', $this->RigCounts);
        if (isset($this->Carriers)) $o['Carriers'] = JsonConverters::toArray('DispatchCarrierPickView', $this->Carriers);
        if (isset($this->QuoteLink)) $o['QuoteLink'] = $this->QuoteLink;
        if (isset($this->Delivery)) $o['Delivery'] = $this->Delivery;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class DispatchRequestAcceptRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $RequestId=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['RequestId'])) $this->RequestId = $o['RequestId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->RequestId)) $o['RequestId'] = $this->RequestId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP DispatchRequestAcceptRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/dispatch/requests/{RequestId}/accept HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<DispatchRequestAcceptRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <RequestId>0</RequestId>
</DispatchRequestAcceptRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<DispatchRequestsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Carriers>
    <DispatchCarrierPickView>
      <VendorID>0</VendorID>
      <VendorName>String</VendorName>
    </DispatchCarrierPickView>
  </Carriers>
  <Delivery>String</Delivery>
  <QuoteLink>String</QuoteLink>
  <Request>
    <AcceptTokenExpiresUtc>0001-01-01T00:00:00</AcceptTokenExpiresUtc>
    <AcceptedUtc>0001-01-01T00:00:00</AcceptedUtc>
    <AcceptedVia>String</AcceptedVia>
    <Cargo>String</Cargo>
    <Code>String</Code>
    <CostPerLoad>0</CostPerLoad>
    <CreatedBy>String</CreatedBy>
    <CreatedUtc>0001-01-01T00:00:00</CreatedUtc>
    <CustomerEmail>String</CustomerEmail>
    <CustomerName>String</CustomerName>
    <CustomerPhone>String</CustomerPhone>
    <DeclineReason>String</DeclineReason>
    <DeclinedBy>String</DeclinedBy>
    <DeclinedUtc>0001-01-01T00:00:00</DeclinedUtc>
    <Events>
      <DispatchRequestEventView>
        <AtUtc>0001-01-01T00:00:00</AtUtc>
        <ByWho>String</ByWho>
        <Detail>String</Detail>
        <EventId>0</EventId>
        <Kind>String</Kind>
      </DispatchRequestEventView>
    </Events>
    <FromLoc>String</FromLoc>
    <IsUrgent>false</IsUrgent>
    <JobsCreated>0</JobsCreated>
    <JobsDone>0</JobsDone>
    <JobsNeedDriver>0</JobsNeedDriver>
    <LoadsNeeded>0</LoadsNeeded>
    <Miles>0</Miles>
    <Notes>String</Notes>
    <QuoteTotal>0</QuoteTotal>
    <QuoteVersion>0</QuoteVersion>
    <QuotedBy>String</QuotedBy>
    <QuotedUtc>0001-01-01T00:00:00</QuotedUtc>
    <RatePerLoad>0</RatePerLoad>
    <RequestId>0</RequestId>
    <RequiredRig>String</RequiredRig>
    <Source>String</Source>
    <Status>String</Status>
    <ToLoc>String</ToLoc>
    <Units>0</Units>
    <UnitsPerTruck>0</UnitsPerTruck>
    <UrgencyPct>0</UrgencyPct>
    <WindowText>String</WindowText>
  </Request>
  <Requests>
    <DispatchRequestView>
      <AcceptTokenExpiresUtc>0001-01-01T00:00:00</AcceptTokenExpiresUtc>
      <AcceptedUtc>0001-01-01T00:00:00</AcceptedUtc>
      <AcceptedVia>String</AcceptedVia>
      <Cargo>String</Cargo>
      <Code>String</Code>
      <CostPerLoad>0</CostPerLoad>
      <CreatedBy>String</CreatedBy>
      <CreatedUtc>0001-01-01T00:00:00</CreatedUtc>
      <CustomerEmail>String</CustomerEmail>
      <CustomerName>String</CustomerName>
      <CustomerPhone>String</CustomerPhone>
      <DeclineReason>String</DeclineReason>
      <DeclinedBy>String</DeclinedBy>
      <DeclinedUtc>0001-01-01T00:00:00</DeclinedUtc>
      <Events>
        <DispatchRequestEventView>
          <AtUtc>0001-01-01T00:00:00</AtUtc>
          <ByWho>String</ByWho>
          <Detail>String</Detail>
          <EventId>0</EventId>
          <Kind>String</Kind>
        </DispatchRequestEventView>
      </Events>
      <FromLoc>String</FromLoc>
      <IsUrgent>false</IsUrgent>
      <JobsCreated>0</JobsCreated>
      <JobsDone>0</JobsDone>
      <JobsNeedDriver>0</JobsNeedDriver>
      <LoadsNeeded>0</LoadsNeeded>
      <Miles>0</Miles>
      <Notes>String</Notes>
      <QuoteTotal>0</QuoteTotal>
      <QuoteVersion>0</QuoteVersion>
      <QuotedBy>String</QuotedBy>
      <QuotedUtc>0001-01-01T00:00:00</QuotedUtc>
      <RatePerLoad>0</RatePerLoad>
      <RequestId>0</RequestId>
      <RequiredRig>String</RequiredRig>
      <Source>String</Source>
      <Status>String</Status>
      <ToLoc>String</ToLoc>
      <Units>0</Units>
      <UnitsPerTruck>0</UnitsPerTruck>
      <UrgencyPct>0</UrgencyPct>
      <WindowText>String</WindowText>
    </DispatchRequestView>
  </Requests>
  <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>
  <RigCounts>
    <DispatchRigCountView>
      <RigType>String</RigType>
      <Rigs>0</Rigs>
    </DispatchRigCountView>
  </RigCounts>
</DispatchRequestsResponse>