Update Trip Status

Trip Management’s update trip status API handles accept, reject, cancel, complete, and receive trip messages by saving the status to the database. After the update is successfully processed, it notifies the user of the trip status update. After a trip is accepted, the route path for the trip will be saved into the database.

POST /trip/tripStatus

(Note: Replaces /trip/reply, which has been deprecated.)

Request Fields

FieldDescriptionTypeRequired
tripIdThe 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.
integerYes if tmsTripId is not supplied.
tmsTripIdThe 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.
stringYes if tripId is not supplied.
statusTrip message from CoPilot
0 = Rejected
1 = Accepted
2 = Completed
3 = Canceled
4 = Received
integerYes
timeStampTimestamp when the trip message was sent from CoPilot. The value must be in ISO-8601 format.dateYes
locationsGPS Coordinates tracked by the vehicle.GPSCoordsYes
locations > coordsThe object containing the latitude/longitude of the GPS.Coords objectYes
locations > coords > latThe GPS latitude. Minimum 4 decimal digits required. Desired 6 decimal digits.stringYes
locations > coords > lonThe GPS longitude. Minimum 4 decimal digits required. Desired 6 decimal digits.stringYes
locations > SpeedSpeedintegerNo
locations > HeadingHeadingintegerNo
locations > AltitudeAltitudeintegerNo
locations > DeviceDTThe device time. The value must be in ISO-8601 format.stringNo

Response Fields

FieldDescriptionType
successtrue or falseboolean
errorCodeNumeric error code. If success is true, errorCode can be ignored.
errorCode = -1, trip can’t be found.
errorCode = -3, trip last modification happened after the timestamp of this request.
integer

Example

Sample Request

{
  "tripId": 12345,
  "status": 2,
  "timeStamp": "2018-03-20T15:00:42.624Z",
  "loc": {
    "Coords": {
      "Lat": "42.364551",
      "Lon": "-71.180604"
    }
  }
}

Sample Response

{
  "success": true,
  "errorCode": 0
}

Error Conditions

FieldDescriptionTypeValues
ErrorTypeThe type of error that occurred.stringArgumentException - a required field was not supplied or an invalid value was passed or an inappropriate action was attempted. Correct the error and try again.
DescriptionAn error message describing what occurred.stringThis message will describe how to fix the error or what went wrong.
ErrorCodeA numerical error code (if applicable).integer

ArgumentException Examples

{
  "ErrorType": "ArgumentException",
  "Description": "Can't update trip status with timestamp older than trip last modified time",
  "ErrorCode": null
}
{
  "ErrorType": "ArgumentException",
  "Description": "Can't perform modification action 'Accepted' if a trip has been 'Canceled'.",
  "ErrorCode": null
}
{
  "ErrorType": "ArgumentException",
  "Description": "Can't perform modification action 'Canceled' if a trip has been 'Completed'.",
  "ErrorCode": null
}
Last updated November 18, 2019.