Skip to main content

Log GPS Event

POST /locations/{location_id}/gps_events

Log a GPS event.

Roles

Users with the following roles may access this endoint:

Driver
ThirdPartyDriver

Breaking Changes

No breaking changes.

Request

POST /locations/{location_id}/gps_events/
Authorization: Bearer {your-auth-token}
Content-Type: application/json
x-tenant-id: {your-tenant-id}
{
"location": {
"activity": {
"confidence": 100,
"type": "unknown"
},
"battery": {
"is_charging": false,
"level": -1
},
"coords": {
"accuracy": 5,
"altitude": 0,
"altitude_accuracy": -1,
"floor": 0,
"heading": 184.57,
"latitude": 37.33517518,
"longitude": -122.03255055,
"speed": 2.41
},
"extras": {},
"is_moving": true,
"odometer": 77163.9,
"timestamp": "2019-02-07T00:12:19.354Z",
"uuid": "81223611-D5FF-4C7E-9BCF-59595D1720AB"
}
}

Path Parameters

location_id Integer, Required

Location identifier.

Query Parameters

note

No query parameters.

Request Headers

Refer to StandardRequestHeadersModel for more details.

authorization String, Required

Authorization header (bearer with access token). See the Authentication Guide to get started.

  • Matches ^bearer [a-z0-9-_=]+.[a-z0-9-_=]+.?[a-z0-9-_.+/=]*$
  • No longer than 256 characters.
  • At least 1 characters long.

Content-Type String, Optional

Default Value: application/json

One of the following MIME types:


x-api-version String, Optional

Request identifier.

  • At least 1 and no more than 64 characters.
  • Must be a valid API version string (2019/02/08, 2021/04/07, 2021/05/07, 2021/08/02, 2021/11/04, 2023/04/19).

x-tenant-id Integer, Required

Tenant identifier. Contact CRO Software for more info if you don't already have this id. See list tenant ids for info on listing the tenants you have access to.

Request Body

Refer to GpsEventProfileModel for more details.

location Object, Required

GpsEventLocationProfileModel

Response

Response Headers

Refer to StandardResponseHeadersModel for more details.

Content-Type String, Optional

Default Value: application/json

One of the following MIME types:


x-api-version String

Request identifier.

  • At least 1 and no more than 64 characters.
  • Must be a valid API version string (2019/02/08, 2021/04/07, 2021/05/07, 2021/08/02, 2021/11/04, 2023/04/19).

x-request-id String

Request identifier.

  • Valid UUID.

Response Body

Refer to GpsStopModel for more details.

bearing Float

Direction of travel at time of measurement.

  • Less than 360.
  • Greater than or equal to 0.

created_on String

Timestamp of creation (must be in past).

  • Date occurring in the past in an ISO 8601 compatible format.

device_name String, Conditional

Name (free text).

  • At least 1 and no more than 64 characters.

driver_id String

Driver identifier.


id Integer

Resource identifier.


latitude Float

Latitude.

  • Less than or equal to 90.
  • Greater than or equal to -90.

longitude Float

longitude.

  • Less than or equal to 180.
  • Greater than or equal to -180.

truck_id Integer

Truck identifier.


velocity Float

Rate of travel at time of measurement.

  • Greater than or equal to 0.

Code Samples

curl --request POST --include \
--header "Authorization: Bearer {your-auth-token}" \
--header "Content-Type: application/json" \
--header "x-tenant-id: {your-tenant-id}" \
--data '{"location": {"activity": {"confidence": 100, "type": "unknown"}, "battery": {"is_charging": false, "level": -1}, "coords": {"accuracy": 5, "altitude": 0, "altitude_accuracy": -1, "floor": 0, "heading": 184.57, "latitude": 37.33517518, "longitude": -122.03255055, "speed": 2.41}, "extras": {}, "is_moving": true, "odometer": 77163.9, "timestamp": "2019-02-07T00:12:19.354Z", "uuid": "81223611-D5FF-4C7E-9BCF-59595D1720AB"}}' \
127.0.0.1:8003/locations/{location_id}/gps_events