Get Directions

Trip Management’s Get Directions provides turn-by-turn directions for the associated route.

POST /trip/getDirections

Resource URL

https://tripmanagement.alk.com/api/trip/getDirections

Request Fields

Field Description Type Required
tripId The alkTripId returned when you planned the trip.
Note: If no trip is found with the given alkTripId, then an error message will be returned. If the tmsTripId in your planning system is also supplied in the body of this request, then the alkTripId will be ignored irrespective of whether it is valid or not and directions for the trip corresponding to the provided tmsTripId will be returned. In this case, if no trip is found with the given tmsTripId, then an error message will be returned.
integer
Yes if tmsTripId is not supplied.
tmsTripId The tmsTripId of your previously generated route.
Note: Even if tripId, which is the alkTripId, is also supplied with this request, it will be ignored and only directions for trip corresponding to the given tmsTripId will be returned. If no trip is found with the given tmsTripId, then an error message will be returned.
string
Yes if tripId is not supplied.
stops This field may optionally be passed in to get the Directions Report using different Stops than the route ran with previously.
Array <Stop>
No
stops > stopSequence The order in which the stops are to be executed.integer Yes, if using a different set of stops than the route ran with previously.
stops > stopType Type of stop
  • Origin,
  • Work,
  • Waypoint,
  • FuelStop,
  • RestStopShort,
  • RestStopLong,
  • RestStopCycleReset,
  • RestStopShortSplittable (EU ONLY),
  • RestStopBiWeekly (EU Only),
  • Destination,
  • RestStopFullDay,
  • RestStopDriverSwitch,
  • BorderCrossing
string
No. Default is Work
stops > location Each stop array must have either coord object or address object for location.Location object Yes, if using a different set of stops than the route ran with previously.
stops > location > address An address object representing the street address, city, state, and postal code of a stop.Address object Yes, if coords object is not supplied and if using a different set of stops than the route ran with previously.
stops > location > address > streetAddress The street address of this trip stop.
string
Yes, if coords object is not supplied and if using a different set of stops than the route ran with previously.
stops > location > address > city The city of this trip stop.
string
Yes, if coords object is not supplied and if using a different set of stops than the route ran with previously.
stops > location > address > state The state of this trip stop.
string
Yes, if coords object is not supplied and if using a different set of stops than the route ran with previously.
stops > location > address > zip The zip/postal code of this trip stop.
string
Yes, if coords object is not supplied and if using a different set of stops than the route ran with previously.
stops > location > address > county The county where this trip stop is located.
string
No
stops > location > coords Contains the latitude and longitude of the stop.Coords object Yes, if address object is not supplied and if using a different set of stops than the route ran with previously.
stops > location > coords > lat The latitude of the stop. Minimum 4 decimal digits required. Desired 6 decimal digits.
string
Yes, if address object is not supplied and if using a different set of stops than the route ran with previously.
stops > location > coords > lon The longitude of the stop.Minimum 4 decimal digits required. Desired 6 decimal digits.
string
Yes, if address object is not supplied and if using a different set of stops than the route ran with previously.
stops > location > label A display name for this trip stop.
string
No
stops > earliestArrivalTime The date and time of start of the appointment window. The value must be in ISO-8601 format.
date
No
stops > latestArrivalTime The date and time of end of the appointment window. The value must be in ISO-8601 format.
date
No
stops > plannedDuration The estimated duration at stop in minutes.
integer
No
stops > atRiskThreshold Number of minutes prior to the end of the delivery window that, if the driver’s ETA lands within this period, the stop will be flagged as “At Risk”. For example, if set to 20 minutes, and the delivery window is from 1pm-3pm, the stop is At Risk if the ETA is anywhere between 2:40pm and 3:00pm. The stop is On Time if ETA is prior to 2:40pm, and Late if ETA is after 3:00pm.
integer
No, default is 15
stops > tooEarlyThreshold Number of minutes prior to the start of the delivery window that, if the driver’s ETA lands before this period, the stop will be flagged as “Too Early”. For example, if set to 20 minutes, and the delivery window is from 1pm-3pm, the stop is “Too Early” if the ETA is anytime before 12:40pm. The stop is Early if ETA is prior to 1:00pm. anywhere between 2:40pm and 3:00pm.
integer
No, default is a high number
stops > metadata Notes about the stop. These will not be delivered to the driver.
string
No

Response Fields

Field Description Type
Origin The Origin Stop of the route.
Stop object
Destination The Destination Stop of the route.
Stop Object
ReportLegs An object containing a the Origin and Destination for each leg, as well as the Directions for that leg
Complex Object

Sample Response

[
  [
    {
      origin: {
        timeZone: "EST",
        errors: [],
        speedLimitInfo: null,
        confidenceLevel: "Exact",
        distanceFromRoad: 0.002,
        distanceFromRoadSpecified: true,
        crossStreet: null,
        address: {
          streetAddress: "24 Yawkey Way",
          city: "Boston",
          state: "MA",
          zip: null,
          county: null,
          country: null,
          splc: null,
          countryPostalFilterSpecified: false,
          abbreviationFormatSpecified: false
        },
        coords: {
          lat: "42.346689",
          lon: "-71.098860"
        },
        region: "NA",
        regionSpecified: true,
        label: "",
        placeName: ""
      },
      destination: {
        timeZone: "EST",
        errors: [],
        speedLimitInfo: null,
        confidenceLevel: "Exact",
        distanceFromRoad: 0.013,
        distanceFromRoadSpecified: true,
        crossStreet: null,
        address: {
          streetAddress: "61 Brookline Avenue",
          city: "Boston",
          state: "MA",
          zip: null,
          county: null,
          country: null,
          splc: null,
          countryPostalFilterSpecified: false,
          abbreviationFormatSpecified: false
        },
        coords: {
          lat: "42.346933",
          lon: "-71.099155"
        },
        region: "NA",
        regionSpecified: true,
        label: "",
        placeName: ""
      },
      reportLegs: [
        {
          origin: {
            timeZone: "EST",
            errors: [],
            speedLimitInfo: null,
            confidenceLevel: "Exact",
            distanceFromRoad: 0.002,
            distanceFromRoadSpecified: true,
            crossStreet: null,
            address: {
              streetAddress: "24 Yawkey Way",
              city: "Boston",
              state: "MA",
              zip: null,
              county: null,
              country: null,
              splc: null,
              countryPostalFilterSpecified: false,
              abbreviationFormatSpecified: false
            },
            coords: {
              lat: "42.346689",
              lon: "-71.098860"
            },
            region: "NA",
            regionSpecified: true,
            label: "",
            placeName: ""
          },
          reportLines: [
            {
              warn: null,
              direction: "24 Yawkey Way, Boston, MA 02215",
              dist: null,
              time: null,
              interCh: null,
              delay: null
            },
            {
              warn: null,
              direction: "Go south on Local",
              dist: null,
              time: null,
              interCh: null,
              delay: null
            },
            {
              warn: null,
              direction: "Drive less than 0.1 miles",
              dist: "0.000",
              time: "0:00",
              interCh: null,
              delay: null
            }
          ],
          dest: {
            timeZone: "EST",
            errors: [],
            speedLimitInfo: null,
            confidenceLevel: "Exact",
            distanceFromRoad: 0.002,
            distanceFromRoadSpecified: true,
            crossStreet: null,
            address: {
              streetAddress: "24 Yawkey Way",
              city: "Boston",
              state: "MA",
              zip: null,
              county: null,
              country: null,
              splc: null,
              countryPostalFilterSpecified: false,
              abbreviationFormatSpecified: false
            },
            coords: {
              lat: "42.346689",
              lon: "-71.098860"
            },
            region: "NA",
            regionSpecified: true,
            label: "",
            placeName: ""
          }
        }
      ],
      routeID: null
    }
  ]
];