Trendsic Platform Service

<back to all web services

DispatchReportRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dashboard/dispatch
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DashboardStatTile:
    key: Optional[str] = None
    label: Optional[str] = None
    value: float = 0.0
    previous_value: Optional[float] = None
    unit: Optional[str] = None
    delta_pct: Optional[float] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportDayRow:
    label: Optional[str] = None
    loads: int = 0
    revenue: float = 0.0
    pay: float = 0.0
    qty: float = 0.0
    avg_cycle_mins: Optional[float] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportModuleRow:
    module: Optional[str] = None
    loads: int = 0
    qty: float = 0.0
    revenue: float = 0.0
    pay: float = 0.0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportLaneRow:
    supplier_name: Optional[str] = None
    source_label: Optional[str] = None
    loads: int = 0
    qty: float = 0.0
    revenue: float = 0.0
    avg_cycle_mins: Optional[float] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportTruckRow:
    truck_label: Optional[str] = None
    driver_label: Optional[str] = None
    loads: int = 0
    qty: float = 0.0
    revenue: float = 0.0
    pay: float = 0.0
    avg_cycle_mins: Optional[float] = None
    days_active: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportDriverRow:
    driver: Optional[str] = None
    driver_contact_id: Optional[int] = None
    loads: int = 0
    qty: float = 0.0
    pay: float = 0.0
    days_active: int = 0
    unpriced: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportJobRow:
    job_code: Optional[str] = None
    customer: Optional[str] = None
    cargo: Optional[str] = None
    route: Optional[str] = None
    miles: int = 0
    revenue: Optional[float] = None
    pay: Optional[float] = None
    margin_pct: Optional[float] = None
    closed_utc: Optional[datetime.datetime] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportIncidentRow:
    kind: Optional[str] = None
    opened: int = 0
    resolved: int = 0
    avg_resolve_mins: Optional[float] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportHoldRow:
    scope_kind: Optional[str] = None
    holds: int = 0
    paused_mins: int = 0
    weather: int = 0
    from_incidents: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportResponse:
    stats: List[DashboardStatTile] = field(default_factory=list)
    unit: Optional[str] = None
    trend: List[DispatchReportDayRow] = field(default_factory=list)
    by_module: List[DispatchReportModuleRow] = field(default_factory=list)
    by_lane: List[DispatchReportLaneRow] = field(default_factory=list)
    by_truck: List[DispatchReportTruckRow] = field(default_factory=list)
    by_driver: List[DispatchReportDriverRow] = field(default_factory=list)
    jobs: List[DispatchReportJobRow] = field(default_factory=list)
    incidents: List[DispatchReportIncidentRow] = field(default_factory=list)
    holds: List[DispatchReportHoldRow] = field(default_factory=list)
    response_status: Optional[ResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchReportRequest:
    from_date: datetime.datetime = datetime.datetime(1, 1, 1)
    to_date: datetime.datetime = datetime.datetime(1, 1, 1)
    location_ids: List[str] = field(default_factory=list)

Python DispatchReportRequest 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/dashboard/dispatch HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<DispatchReportRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <FromDate>0001-01-01T00:00:00</FromDate>
  <LocationIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:guid>00000000-0000-0000-0000-000000000000</d2p1:guid>
  </LocationIds>
  <ToDate>0001-01-01T00:00:00</ToDate>
</DispatchReportRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<DispatchReportResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <ByDriver>
    <DispatchReportDriverRow>
      <DaysActive>0</DaysActive>
      <Driver>String</Driver>
      <DriverContactId>0</DriverContactId>
      <Loads>0</Loads>
      <Pay>0</Pay>
      <Qty>0</Qty>
      <Unpriced>0</Unpriced>
    </DispatchReportDriverRow>
  </ByDriver>
  <ByLane>
    <DispatchReportLaneRow>
      <AvgCycleMins>0</AvgCycleMins>
      <Loads>0</Loads>
      <Qty>0</Qty>
      <Revenue>0</Revenue>
      <SourceLabel>String</SourceLabel>
      <SupplierName>String</SupplierName>
    </DispatchReportLaneRow>
  </ByLane>
  <ByModule>
    <DispatchReportModuleRow>
      <Loads>0</Loads>
      <Module>String</Module>
      <Pay>0</Pay>
      <Qty>0</Qty>
      <Revenue>0</Revenue>
    </DispatchReportModuleRow>
  </ByModule>
  <ByTruck>
    <DispatchReportTruckRow>
      <AvgCycleMins>0</AvgCycleMins>
      <DaysActive>0</DaysActive>
      <DriverLabel>String</DriverLabel>
      <Loads>0</Loads>
      <Pay>0</Pay>
      <Qty>0</Qty>
      <Revenue>0</Revenue>
      <TruckLabel>String</TruckLabel>
    </DispatchReportTruckRow>
  </ByTruck>
  <Holds>
    <DispatchReportHoldRow>
      <FromIncidents>0</FromIncidents>
      <Holds>0</Holds>
      <PausedMins>0</PausedMins>
      <ScopeKind>String</ScopeKind>
      <Weather>0</Weather>
    </DispatchReportHoldRow>
  </Holds>
  <Incidents>
    <DispatchReportIncidentRow>
      <AvgResolveMins>0</AvgResolveMins>
      <Kind>String</Kind>
      <Opened>0</Opened>
      <Resolved>0</Resolved>
    </DispatchReportIncidentRow>
  </Incidents>
  <Jobs>
    <DispatchReportJobRow>
      <Cargo>String</Cargo>
      <ClosedUtc>0001-01-01T00:00:00</ClosedUtc>
      <Customer>String</Customer>
      <JobCode>String</JobCode>
      <MarginPct>0</MarginPct>
      <Miles>0</Miles>
      <Pay>0</Pay>
      <Revenue>0</Revenue>
      <Route>String</Route>
    </DispatchReportJobRow>
  </Jobs>
  <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>
  <Stats>
    <DashboardStatTile>
      <Key>String</Key>
      <Label>String</Label>
      <PreviousValue>0</PreviousValue>
      <Unit>String</Unit>
      <Value>0</Value>
    </DashboardStatTile>
  </Stats>
  <Trend>
    <DispatchReportDayRow>
      <AvgCycleMins>0</AvgCycleMins>
      <Label>String</Label>
      <Loads>0</Loads>
      <Pay>0</Pay>
      <Qty>0</Qty>
      <Revenue>0</Revenue>
    </DispatchReportDayRow>
  </Trend>
  <Unit>String</Unit>
</DispatchReportResponse>