Dispatch

Dispatch method can optimize 100's of stops using one or several vehicles. You can use address or latitude/longitude to define a location of a Vehicle and a Stop.

Use the followith URL template to dispatch a route. Request type must be POST for both XML and JSON format.

http://trackservice.trackroad.com/rest/dispatch/key

You must login to get a key.

For more details about request parameters see DispatchSpecification.

ABSTRACT SAMPLE

XML

To receive response in XML format you must specify content type text/xml or application/xml. For example:

...
httpWReq.Method = "POST";
httpWReq.ContentType = "text/xml; charset=utf-8";
httpWReq.ContentLength = data.Length;
...

XML request

The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.

<DispatchSpecification>
  <IsNeedMatchCode>false</IsNeedMatchCode>
  <CurrentTime>0001-01-01T00:00:00</CurrentTime>
  <DispatchMode>Auto</DispatchMode>
  <MinimumOptimization>1</MinimumOptimization>
  <DistanceUnit>Mile</DistanceUnit>
  <Vehicles>
    <Vehicle>
      <Name>V1</Name>
      <Speed>0</Speed>
      <MaxStops>0</MaxStops>
      <MaxWeight>0</MaxWeight>
      <MaxSkids>0</MaxSkids>
      <MaxVolume>0</MaxVolume>
      <MaxMinutes>0</MaxMinutes>
      <OnTheRoad>false</OnTheRoad>
      <Tin>0001-01-01T00:00:00</Tin>
      <Tout>0001-01-01T00:00:00</Tout>
      <StartLocation>
        <LatLong>
          <Latitude>27.9642601</Latitude>
          <Longitude>-82.494751</Longitude>
        </LatLong>
      </StartLocation>
    </Vehicle>
  </Vehicles>
  <Locations>
    <Location>
      <Name>Brussel</Name>
      <LatLong>
        <Latitude>28.0548688</Latitude>
        <Longitude>-82.4993688</Longitude>
      </LatLong>
    </Location>
  </Locations>
</DispatchSpecification>

XML response

<DispatchResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Errors />
  <Status>Success</Status>
  <Items>
    <VehicleItem>
      <Vehicle>
        <Name>V1</Name>
        <Email />
        <Group />
      </Vehicle>
      <Locations>
        <Location>
          <Name>V1</Name>
          <Delivery />
          <Vehicle />
          <Phone />
          <LatLong>
            <Latitude>27.9642601</Latitude>
            <Longitude>-82.494751</Longitude>
          </LatLong>
          <Address>
            <Street />
            <City />
            <State />
            <PostalCode />
            <Country />
          </Address>
          <LocationType>Start</LocationType>
          <Distance>7.1526659309631748</Distance>
          <Time>867</Time>
        </Location>
        <Location>
          <Name>Brussel</Name>
          <Delivery />
          <Vehicle />
          <Description />
          <Phone />
          <LatLong>
            <Latitude>28.0548688</Latitude>
            <Longitude>-82.4993688</Longitude>
          </LatLong>
          <Address>
            <Street />
            <City />
            <State />
            <PostalCode />
            <Country />
          </Address>
        </Location>
      </Locations>
    </VehicleItem>
  </Items>
</DispatchResult>

JSON

To receive response in JSON format you must specify content type text/json or application/json. For example:

...
httpWReq.Method = "POST";
httpWReq.ContentType = "text/json; charset=utf-8";
httpWReq.ContentLength = data.Length;
...

JSON request

The following request uses Latitude and Longitude for Vehicle start location and Latitude and Longitude for a location.

{
    "RoutingService":0,
    "IsNeedMatchCode":false,
    "CurrentTime":"0001-01-01T00:00:00Z",
    "DispatchMode":0,
    "MinimumOptimization":1,
    "DistanceUnit":0,
    "Vehicles":
    [
        {
            "Name":"V1",
            "Email":null,
            "Group":null,
            "Speed":0,
            "MaxStops":0,
            "MaxWeight":0,
            "MaxSkids":0,
            "MaxVolume":0,
            "MaxMinutes":0,
            "OnTheRoad":false,
            "Tin":"0001-01-01T00:00:00Z",
            "Tout":"0001-01-01T00:00:00Z",
            "StartLocation":
                {
                    "MatchCode":0,
                    "Name":null,
                    "Delivery":null,
                    "Vehicle":null,
                    "Description":null,
                    "Phone":null,
                    "LatLong":
                        {
                            "Latitude":27.9642601,
                            "Longitude":-82.494751
                        },
                    "Address":null,
                    "Priority":0,
                    "Wait":0,
                    "Volume":0,
                    "Weight":0,
                    "Skids":0,
                    "TimeConstraintArrival":"0001-01-01T00:00:00Z",
                    "TimeConstraintDeparture":"0001-01-01T00:00:00Z",
                    "TimeConstraintArrival2":"0001-01-01T00:00:00Z",
                    "TimeConstraintDeparture2":"0001-01-01T00:00:00Z",
                    "LocationType":0,
                    "CanArriveEarly":true,
                    "Distance":0,
                    "Time":0
                },
            "FinishLocation":null
        }
    ],
    "Locations":
    [
        {
            "MatchCode":0,
            "Name":"Brussel",
            "Delivery":null,
            "Vehicle":null,
            "Description":null,
            "Phone":null,
            "LatLong":
                {
                    "Latitude":28.0548688,
                    "Longitude":-82.4993688
                },
            "Address":null,
            "Priority":0,
            "Wait":0,
            "Volume":0,
            "Weight":0,
            "Skids":0,
            "TimeConstraintArrival":"0001-01-01T00:00:00Z",
            "TimeConstraintDeparture":"0001-01-01T00:00:00Z",
            "TimeConstraintArrival2":"0001-01-01T00:00:00Z",
            "TimeConstraintDeparture2":"0001-01-01T00:00:00Z",
            "LocationType":0,
            "CanArriveEarly":true,
            "Distance":0,
            "Time":0
        }
    ]
}

JSON Response

{
   "Items":[
      {
         "Vehicle":{
            "Name":"V1",
            "Email":"",
            "Group":"",
            "Speed":0,
            "MaxStops":0,
            "MaxWeight":0.0,
            "MaxSkids":0,
            "MaxVolume":0.0,
            "MaxMinutes":0,
            "OnTheRoad":false,
            "Tin":"0001-01-01T00:00:00Z",
            "Tout":"0001-01-01T00:00:00Z",
            "StartLocation":null,
            "FinishLocation":null
         },
         "Locations":[
            {
               "MatchCode":0,
               "Name":"V1",
               "Delivery":"",
               "Vehicle":"",
               "Description":null,
               "Phone":"",
               "LatLong":{
                  "Latitude":27.9642601,
                  "Longitude":-82.494751
               },
               "Address":{
                  "Street":"",
                  "City":"",
                  "State":"",
                  "PostalCode":"",
                  "Country":""
               },
               "Priority":0,
               "Wait":0,
               "Volume":0.0,
               "Weight":0.0,
               "Skids":0,
               "TimeConstraintArrival":"0001-01-01T00:00:00",
               "TimeConstraintDeparture":"0001-01-01T00:00:00",
               "TimeConstraintArrival2":"0001-01-01T00:00:00",
               "TimeConstraintDeparture2":"0001-01-01T00:00:00",
               "LocationType":1,
               "CanArriveEarly":true,
               "Distance":7.1526659309631748,
               "Time":867
            },
            {
               "MatchCode":0,
               "Name":"Brussel",
               "Delivery":"",
               "Vehicle":"",
               "Description":"",
               "Phone":"",
               "LatLong":{
                  "Latitude":28.0548688,
                  "Longitude":-82.4993688
               },
               "Address":{
                  "Street":"",
                  "City":"",
                  "State":"",
                  "PostalCode":"",
                  "Country":""
               },
               "Priority":0,
               "Wait":0,
               "Volume":0.0,
               "Weight":0.0,
               "Skids":0,
               "TimeConstraintArrival":"0001-01-01T00:00:00Z",
               "TimeConstraintDeparture":"0001-01-01T00:00:00Z",
               "TimeConstraintArrival2":"0001-01-01T00:00:00",
               "TimeConstraintDeparture2":"0001-01-01T00:00:00",
               "LocationType":0,
               "CanArriveEarly":true,
               "Distance":0.0,
               "Time":0
            }
         ]
      }
   ],
   "Errors":[

   ],
   "Status":1
}

See Also

Dispatch Specification
Dispatch using Address and Latitude/Longitude Only (XML)
Dispatch using Address and Latitude/Longitude Only (JSON)