Update Positions

Trip Management’s Update GPS Positions API lets you add a list of GPS points traced by the vehicle. If the received GPS position is not within the region set during trip planning, an error message will be returned.

POST /trip/gpsposition

Resource URL

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

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 the trip corresponding to the provided tmsTripId will be updated. 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 trip corresponding to the given tmsTripId will be updated. If no trip is found with the given tmsTripId, then an error message will be returned.
string
Yes if tripId is not supplied.
locations List of GPS Coordinates tracked by the vehicle. If no time is provided, then the list should be in ascending order. i.e. the last position should be at the end of the list.
List <GPSCoords>
Yes
locations > coords The object containing the latitude/longitude of the GPS.
Coords object
Yes
locations > coords > lat The GPS latitude. Minimum 4 decimal digits required. Desired 6 decimal digits.
string
Yes
locations > coords > lon The GPS longitude. Minimum 4 decimal digits required. Desired 6 decimal digits.
string
Yes
locations > Speed Speed
integer
No
locations > Heading Heading
integer
No
locations > Altitude Altitude
integer
No
locations > DeviceDT The device time. The value must be in ISO-8601 format.
string
No

Sample Request

{
  "tripId": "136",
  "locations": [
    {
      "coords": {
        "lat": "40.058447",
        "lon": "-78.081017"
      },
      "speed": 45,
      "heading": 26,
      "altitude": 1000,
      "deviceDT": "2017-09-06T19:05:16+00:00"
    },
    {
      "coords": {
        "lat": "40.061247",
        "lon": "-78.099054"
      },
      "deviceDT": "2017-09-07T01:05:16-04:00"
    }
  ]
}

Sample Response

{
  "success": true,
  "message": null
}