GetLocationHistory
GET/location/history
Get location history for one, all, or a group of devices specified by tags parameter.
Location history is recorded only for location requests that devices authorize with their own JSON Web Token. Requests authorized with an Organization Auth Token are not recorded.
The Organization Auth Token requires the device:read permission.
Notes:
- Location history data expires after ~6 months (27 weeks)
- The
serviceTypefield is intentionally empty for location data before December 10th 2021
Basic Request for device history:
curl -G "$API_HOST/v1/organizations/$ORG_SLUG/projects/$PROJECT_SLUG/location/history" -d "deviceId=$DEVICE_ID&start=2022-10-15T06:00:00.000Z&end=2022-10-16T18:30:00.000Z" -H "Authorization: Bearer $NRFCLOUD_OAT"
Paginated Request:
export PAGE_NEXT_TOKEN=$(curl -G "$API_HOST/v1/organizations/$ORG_SLUG/projects/$PROJECT_SLUG/location/history" -d "deviceId=$DEVICE_ID&start=2022-10-15T06:00:00.000Z&end=2022-10-16T18:30:00.000Z" -H "Authorization: Bearer $NRFCLOUD_OAT" | jq .pageNextToken)
curl -G "$API_HOST/v1/organizations/$ORG_SLUG/projects/$PROJECT_SLUG/location/history" -d "deviceId=$DEVICE_ID" --data-urlencode "pageNextToken=$PAGE_NEXT_TOKEN" -H "Authorization: Bearer $NRFCLOUD_OAT"
Request all devices location history:
curl -G "$API_HOST/v1/organizations/$ORG_SLUG/projects/$PROJECT_SLUG/location/history" -H "Authorization: Bearer $NRFCLOUD_OAT"
Request all devices last known location:
curl -G "$API_HOST/v1/organizations/$ORG_SLUG/projects/$PROJECT_SLUG/location/history" -d "latest=true" -H "Authorization: Bearer $NRFCLOUD_OAT"
Request
Responses
- 200
- 403
- 422
Contains JSON response
Forbidden. The Organization Auth Token lacks the required permission: device:read to list location history, or device:write to delete a record.
Unprocessable Entity. A query parameter, header, or the request body is missing or invalid.