Trendsic Platform Service

<back to all web services

CourierOrderRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/dispatch/courier/orders/{Code}
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 CourierOrderRuleView:
    ping_secs: int = 0
    missed_wait_min: int = 0
    missed_fee: Decimal = decimal.Decimal(0)
    cancel_fee: Decimal = decimal.Decimal(0)
    missed_auto_rebook: bool = False
    missed_require_contact: bool = False
    missed_require_photo: bool = False
    pay_timing: Optional[str] = None
    final_price_after_count: bool = False
    pay_plan_name: Optional[str] = None
    per_pickup: Decimal = decimal.Decimal(0)
    per_stop: Decimal = decimal.Decimal(0)
    per_missed: Decimal = decimal.Decimal(0)
    per_cancel: Decimal = decimal.Decimal(0)
    accepted_utc: Optional[datetime.datetime] = None
    proof: Dict[str, str] = field(default_factory=dict)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierItemView:
    courier_item_i_d: int = 0
    dispatch_od_request_i_d: int = 0
    seq: int = 0
    tag_code: Optional[str] = None
    custody: Optional[str] = None
    is_open: bool = False
    is_missing: bool = False
    missing_reason: Optional[str] = None
    is_manual: bool = False
    re_tag_flag: bool = False
    scanned: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierScanView:
    tag_code: Optional[str] = None
    stage: Optional[str] = None
    result: Optional[str] = None
    at_utc: datetime.datetime = datetime.datetime(1, 1, 1)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierProofResultView:
    stage: Optional[str] = None
    step_key: Optional[str] = None
    value: Optional[str] = None
    at_utc: datetime.datetime = datetime.datetime(1, 1, 1)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierEventView:
    kind: Optional[str] = None
    party: Optional[str] = None
    body: Optional[str] = None
    at_utc: datetime.datetime = datetime.datetime(1, 1, 1)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierPhotoView:
    photo_id: int = 0
    kind: Optional[str] = None
    file_name: Optional[str] = None
    url: Optional[str] = None
    taken_utc: Optional[datetime.datetime] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierPayLineView:
    dispatch_load_i_d: int = 0
    kind: Optional[str] = None
    label: Optional[str] = None
    qty: Optional[Decimal] = None
    rate: Optional[Decimal] = None
    amount: Decimal = decimal.Decimal(0)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierOrderView:
    dispatch_od_request_i_d: int = 0
    code: Optional[str] = None
    courier_profile_id: int = 0
    profile_name: Optional[str] = None
    route_shape: Optional[str] = None
    unit_one: Optional[str] = None
    unit_many: Optional[str] = None
    courier_facility_id: Optional[int] = None
    facility_name: Optional[str] = None
    service_level_code: Optional[str] = None
    level_name: Optional[str] = None
    source: Optional[str] = None
    address: Optional[str] = None
    unit: Optional[str] = None
    city: Optional[str] = None
    zip: Optional[str] = None
    zone: Optional[str] = None
    pickup_contact_name: Optional[str] = None
    dropoff_address: Optional[str] = None
    dropoff_unit: Optional[str] = None
    dropoff_city: Optional[str] = None
    dropoff_zip: Optional[str] = None
    dropoff_contact_name: Optional[str] = None
    miles: Optional[Decimal] = None
    units: int = 0
    units_found: Optional[int] = None
    stage: Optional[str] = None
    courier_step: Optional[str] = None
    step_label: Optional[str] = None
    driver_code: Optional[str] = None
    driver_name: Optional[str] = None
    driver_contact_id: Optional[int] = None
    courier_run_id: Optional[int] = None
    run_code: Optional[str] = None
    stop_sequence: Optional[int] = None
    queue_sequence: Optional[int] = None
    is_asap: bool = False
    window_start_utc: Optional[datetime.datetime] = None
    window_end_utc: Optional[datetime.datetime] = None
    window_text: Optional[str] = None
    due_utc: Optional[datetime.datetime] = None
    due_text: Optional[str] = None
    ping_after_utc: Optional[datetime.datetime] = None
    ping_expires_utc: Optional[datetime.datetime] = None
    candidate_code: Optional[str] = None
    held_reason: Optional[str] = None
    held_utc: Optional[datetime.datetime] = None
    customer_name: Optional[str] = None
    customer_phone: Optional[str] = None
    handoff: Optional[str] = None
    gate_code: Optional[str] = None
    instructions: Optional[str] = None
    damage_note: Optional[str] = None
    delivered_to_name: Optional[str] = None
    pay_mode: Optional[str] = None
    fare: Optional[Decimal] = None
    final_price: Optional[Decimal] = None
    tip_amount: Optional[Decimal] = None
    cancelled_by: Optional[str] = None
    cancel_reason: Optional[str] = None
    cancel_fee_applied: Optional[Decimal] = None
    missed_fee_applied: Optional[Decimal] = None
    capture_mode: Optional[str] = None
    authorized_amount: Optional[Decimal] = None
    captured_amount: Optional[Decimal] = None
    refunded_amount: Decimal = decimal.Decimal(0)
    charge_error: Optional[str] = None
    created_at: Optional[datetime.datetime] = None
    arrived_utc: Optional[datetime.datetime] = None
    picked_up_utc: Optional[datetime.datetime] = None
    intake_utc: Optional[datetime.datetime] = None
    ready_utc: Optional[datetime.datetime] = None
    out_for_delivery_utc: Optional[datetime.datetime] = None
    delivered_utc: Optional[datetime.datetime] = None
    missed_utc: Optional[datetime.datetime] = None
    cancelled_utc: Optional[datetime.datetime] = None
    is_closed: bool = False
    rebook_of_id: Optional[int] = None
    recurrence_id: Optional[int] = None
    pickup_load_id: Optional[int] = None
    rule: Optional[CourierOrderRuleView] = None
    items: List[CourierItemView] = field(default_factory=list)
    scans: List[CourierScanView] = field(default_factory=list)
    proof: List[CourierProofResultView] = field(default_factory=list)
    events: List[CourierEventView] = field(default_factory=list)
    photos: List[CourierPhotoView] = field(default_factory=list)
    pay_lines: List[CourierPayLineView] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierOrderResponse:
    orders: List[CourierOrderView] = field(default_factory=list)
    order: Optional[CourierOrderView] = None
    message: Optional[str] = None
    response_status: Optional[ResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierOrderRequest:
    code: Optional[str] = None

Python CourierOrderRequest 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.

GET /v1/dispatch/courier/orders/{Code} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CourierOrderResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Message>String</Message>
  <Order>
    <Address>String</Address>
    <ArrivedUtc>0001-01-01T00:00:00</ArrivedUtc>
    <AuthorizedAmount>0</AuthorizedAmount>
    <CancelFeeApplied>0</CancelFeeApplied>
    <CancelReason>String</CancelReason>
    <CancelledBy>String</CancelledBy>
    <CancelledUtc>0001-01-01T00:00:00</CancelledUtc>
    <CandidateCode>String</CandidateCode>
    <CaptureMode>String</CaptureMode>
    <CapturedAmount>0</CapturedAmount>
    <ChargeError>String</ChargeError>
    <City>String</City>
    <Code>String</Code>
    <CourierFacilityId>0</CourierFacilityId>
    <CourierProfileId>0</CourierProfileId>
    <CourierRunId>0</CourierRunId>
    <CourierStep>String</CourierStep>
    <CreatedAt>0001-01-01T00:00:00</CreatedAt>
    <CustomerName>String</CustomerName>
    <CustomerPhone>String</CustomerPhone>
    <DamageNote>String</DamageNote>
    <DeliveredToName>String</DeliveredToName>
    <DeliveredUtc>0001-01-01T00:00:00</DeliveredUtc>
    <DispatchOdRequestID>0</DispatchOdRequestID>
    <DriverCode>String</DriverCode>
    <DriverContactId>0</DriverContactId>
    <DriverName>String</DriverName>
    <DropoffAddress>String</DropoffAddress>
    <DropoffCity>String</DropoffCity>
    <DropoffContactName>String</DropoffContactName>
    <DropoffUnit>String</DropoffUnit>
    <DropoffZip>String</DropoffZip>
    <DueText>String</DueText>
    <DueUtc>0001-01-01T00:00:00</DueUtc>
    <Events>
      <CourierEventView>
        <AtUtc>0001-01-01T00:00:00</AtUtc>
        <Body>String</Body>
        <Kind>String</Kind>
        <Party>String</Party>
      </CourierEventView>
    </Events>
    <FacilityName>String</FacilityName>
    <Fare>0</Fare>
    <FinalPrice>0</FinalPrice>
    <GateCode>String</GateCode>
    <Handoff>String</Handoff>
    <HeldReason>String</HeldReason>
    <HeldUtc>0001-01-01T00:00:00</HeldUtc>
    <Instructions>String</Instructions>
    <IntakeUtc>0001-01-01T00:00:00</IntakeUtc>
    <IsAsap>false</IsAsap>
    <IsClosed>false</IsClosed>
    <Items>
      <CourierItemView>
        <CourierItemID>0</CourierItemID>
        <Custody>String</Custody>
        <DispatchOdRequestID>0</DispatchOdRequestID>
        <IsManual>false</IsManual>
        <IsMissing>false</IsMissing>
        <IsOpen>false</IsOpen>
        <MissingReason>String</MissingReason>
        <ReTagFlag>false</ReTagFlag>
        <Scanned>false</Scanned>
        <Seq>0</Seq>
        <TagCode>String</TagCode>
      </CourierItemView>
    </Items>
    <LevelName>String</LevelName>
    <Miles>0</Miles>
    <MissedFeeApplied>0</MissedFeeApplied>
    <MissedUtc>0001-01-01T00:00:00</MissedUtc>
    <OutForDeliveryUtc>0001-01-01T00:00:00</OutForDeliveryUtc>
    <PayLines>
      <CourierPayLineView>
        <Amount>0</Amount>
        <DispatchLoadID>0</DispatchLoadID>
        <Kind>String</Kind>
        <Label>String</Label>
        <Qty>0</Qty>
        <Rate>0</Rate>
      </CourierPayLineView>
    </PayLines>
    <PayMode>String</PayMode>
    <Photos>
      <CourierPhotoView>
        <FileName>String</FileName>
        <Kind>String</Kind>
        <PhotoId>0</PhotoId>
        <TakenUtc>0001-01-01T00:00:00</TakenUtc>
        <Url>String</Url>
      </CourierPhotoView>
    </Photos>
    <PickedUpUtc>0001-01-01T00:00:00</PickedUpUtc>
    <PickupContactName>String</PickupContactName>
    <PickupLoadId>0</PickupLoadId>
    <PingAfterUtc>0001-01-01T00:00:00</PingAfterUtc>
    <PingExpiresUtc>0001-01-01T00:00:00</PingExpiresUtc>
    <ProfileName>String</ProfileName>
    <Proof>
      <CourierProofResultView>
        <AtUtc>0001-01-01T00:00:00</AtUtc>
        <Stage>String</Stage>
        <StepKey>String</StepKey>
        <Value>String</Value>
      </CourierProofResultView>
    </Proof>
    <QueueSequence>0</QueueSequence>
    <ReadyUtc>0001-01-01T00:00:00</ReadyUtc>
    <RebookOfId>0</RebookOfId>
    <RecurrenceId>0</RecurrenceId>
    <RefundedAmount>0</RefundedAmount>
    <RouteShape>String</RouteShape>
    <Rule>
      <AcceptedUtc>0001-01-01T00:00:00</AcceptedUtc>
      <CancelFee>0</CancelFee>
      <FinalPriceAfterCount>false</FinalPriceAfterCount>
      <MissedAutoRebook>false</MissedAutoRebook>
      <MissedFee>0</MissedFee>
      <MissedRequireContact>false</MissedRequireContact>
      <MissedRequirePhoto>false</MissedRequirePhoto>
      <MissedWaitMin>0</MissedWaitMin>
      <PayPlanName>String</PayPlanName>
      <PayTiming>String</PayTiming>
      <PerCancel>0</PerCancel>
      <PerMissed>0</PerMissed>
      <PerPickup>0</PerPickup>
      <PerStop>0</PerStop>
      <PingSecs>0</PingSecs>
      <Proof xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringstring>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value>String</d4p1:Value>
        </d4p1:KeyValueOfstringstring>
      </Proof>
    </Rule>
    <RunCode>String</RunCode>
    <Scans>
      <CourierScanView>
        <AtUtc>0001-01-01T00:00:00</AtUtc>
        <Result>String</Result>
        <Stage>String</Stage>
        <TagCode>String</TagCode>
      </CourierScanView>
    </Scans>
    <ServiceLevelCode>String</ServiceLevelCode>
    <Source>String</Source>
    <Stage>String</Stage>
    <StepLabel>String</StepLabel>
    <StopSequence>0</StopSequence>
    <TipAmount>0</TipAmount>
    <Unit>String</Unit>
    <UnitMany>String</UnitMany>
    <UnitOne>String</UnitOne>
    <Units>0</Units>
    <UnitsFound>0</UnitsFound>
    <WindowEndUtc>0001-01-01T00:00:00</WindowEndUtc>
    <WindowStartUtc>0001-01-01T00:00:00</WindowStartUtc>
    <WindowText>String</WindowText>
    <Zip>String</Zip>
    <Zone>String</Zone>
  </Order>
  <Orders>
    <CourierOrderView>
      <Address>String</Address>
      <ArrivedUtc>0001-01-01T00:00:00</ArrivedUtc>
      <AuthorizedAmount>0</AuthorizedAmount>
      <CancelFeeApplied>0</CancelFeeApplied>
      <CancelReason>String</CancelReason>
      <CancelledBy>String</CancelledBy>
      <CancelledUtc>0001-01-01T00:00:00</CancelledUtc>
      <CandidateCode>String</CandidateCode>
      <CaptureMode>String</CaptureMode>
      <CapturedAmount>0</CapturedAmount>
      <ChargeError>String</ChargeError>
      <City>String</City>
      <Code>String</Code>
      <CourierFacilityId>0</CourierFacilityId>
      <CourierProfileId>0</CourierProfileId>
      <CourierRunId>0</CourierRunId>
      <CourierStep>String</CourierStep>
      <CreatedAt>0001-01-01T00:00:00</CreatedAt>
      <CustomerName>String</CustomerName>
      <CustomerPhone>String</CustomerPhone>
      <DamageNote>String</DamageNote>
      <DeliveredToName>String</DeliveredToName>
      <DeliveredUtc>0001-01-01T00:00:00</DeliveredUtc>
      <DispatchOdRequestID>0</DispatchOdRequestID>
      <DriverCode>String</DriverCode>
      <DriverContactId>0</DriverContactId>
      <DriverName>String</DriverName>
      <DropoffAddress>String</DropoffAddress>
      <DropoffCity>String</DropoffCity>
      <DropoffContactName>String</DropoffContactName>
      <DropoffUnit>String</DropoffUnit>
      <DropoffZip>String</DropoffZip>
      <DueText>String</DueText>
      <DueUtc>0001-01-01T00:00:00</DueUtc>
      <Events>
        <CourierEventView>
          <AtUtc>0001-01-01T00:00:00</AtUtc>
          <Body>String</Body>
          <Kind>String</Kind>
          <Party>String</Party>
        </CourierEventView>
      </Events>
      <FacilityName>String</FacilityName>
      <Fare>0</Fare>
      <FinalPrice>0</FinalPrice>
      <GateCode>String</GateCode>
      <Handoff>String</Handoff>
      <HeldReason>String</HeldReason>
      <HeldUtc>0001-01-01T00:00:00</HeldUtc>
      <Instructions>String</Instructions>
      <IntakeUtc>0001-01-01T00:00:00</IntakeUtc>
      <IsAsap>false</IsAsap>
      <IsClosed>false</IsClosed>
      <Items>
        <CourierItemView>
          <CourierItemID>0</CourierItemID>
          <Custody>String</Custody>
          <DispatchOdRequestID>0</DispatchOdRequestID>
          <IsManual>false</IsManual>
          <IsMissing>false</IsMissing>
          <IsOpen>false</IsOpen>
          <MissingReason>String</MissingReason>
          <ReTagFlag>false</ReTagFlag>
          <Scanned>false</Scanned>
          <Seq>0</Seq>
          <TagCode>String</TagCode>
        </CourierItemView>
      </Items>
      <LevelName>String</LevelName>
      <Miles>0</Miles>
      <MissedFeeApplied>0</MissedFeeApplied>
      <MissedUtc>0001-01-01T00:00:00</MissedUtc>
      <OutForDeliveryUtc>0001-01-01T00:00:00</OutForDeliveryUtc>
      <PayLines>
        <CourierPayLineView>
          <Amount>0</Amount>
          <DispatchLoadID>0</DispatchLoadID>
          <Kind>String</Kind>
          <Label>String</Label>
          <Qty>0</Qty>
          <Rate>0</Rate>
        </CourierPayLineView>
      </PayLines>
      <PayMode>String</PayMode>
      <Photos>
        <CourierPhotoView>
          <FileName>String</FileName>
          <Kind>String</Kind>
          <PhotoId>0</PhotoId>
          <TakenUtc>0001-01-01T00:00:00</TakenUtc>
          <Url>String</Url>
        </CourierPhotoView>
      </Photos>
      <PickedUpUtc>0001-01-01T00:00:00</PickedUpUtc>
      <PickupContactName>String</PickupContactName>
      <PickupLoadId>0</PickupLoadId>
      <PingAfterUtc>0001-01-01T00:00:00</PingAfterUtc>
      <PingExpiresUtc>0001-01-01T00:00:00</PingExpiresUtc>
      <ProfileName>String</ProfileName>
      <Proof>
        <CourierProofResultView>
          <AtUtc>0001-01-01T00:00:00</AtUtc>
          <Stage>String</Stage>
          <StepKey>String</StepKey>
          <Value>String</Value>
        </CourierProofResultView>
      </Proof>
      <QueueSequence>0</QueueSequence>
      <ReadyUtc>0001-01-01T00:00:00</ReadyUtc>
      <RebookOfId>0</RebookOfId>
      <RecurrenceId>0</RecurrenceId>
      <RefundedAmount>0</RefundedAmount>
      <RouteShape>String</RouteShape>
      <Rule>
        <AcceptedUtc>0001-01-01T00:00:00</AcceptedUtc>
        <CancelFee>0</CancelFee>
        <FinalPriceAfterCount>false</FinalPriceAfterCount>
        <MissedAutoRebook>false</MissedAutoRebook>
        <MissedFee>0</MissedFee>
        <MissedRequireContact>false</MissedRequireContact>
        <MissedRequirePhoto>false</MissedRequirePhoto>
        <MissedWaitMin>0</MissedWaitMin>
        <PayPlanName>String</PayPlanName>
        <PayTiming>String</PayTiming>
        <PerCancel>0</PerCancel>
        <PerMissed>0</PerMissed>
        <PerPickup>0</PerPickup>
        <PerStop>0</PerStop>
        <PingSecs>0</PingSecs>
        <Proof xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Proof>
      </Rule>
      <RunCode>String</RunCode>
      <Scans>
        <CourierScanView>
          <AtUtc>0001-01-01T00:00:00</AtUtc>
          <Result>String</Result>
          <Stage>String</Stage>
          <TagCode>String</TagCode>
        </CourierScanView>
      </Scans>
      <ServiceLevelCode>String</ServiceLevelCode>
      <Source>String</Source>
      <Stage>String</Stage>
      <StepLabel>String</StepLabel>
      <StopSequence>0</StopSequence>
      <TipAmount>0</TipAmount>
      <Unit>String</Unit>
      <UnitMany>String</UnitMany>
      <UnitOne>String</UnitOne>
      <Units>0</Units>
      <UnitsFound>0</UnitsFound>
      <WindowEndUtc>0001-01-01T00:00:00</WindowEndUtc>
      <WindowStartUtc>0001-01-01T00:00:00</WindowStartUtc>
      <WindowText>String</WindowText>
      <Zip>String</Zip>
      <Zone>String</Zone>
    </CourierOrderView>
  </Orders>
  <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>
</CourierOrderResponse>