Last position

Service version: 1
Last edit: 2022.08.31

Purpose

This endpoint requests an object's most recent position. If consent is given, the Geofencing API can also provide locations that will be available through this endpoint.

Request data

HTTPS method: GET

  • Constants and parameters enclosed in curly brackets { } must be replaced with their values.
  • Please see the following Request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.

URL request format

get
URL request format
https://{baseURL}/locationHistory/{versionNumber}/history/position/{objectId}?key={Your_API_Key}

curl command request format

get
curl command request format
curl 'https://{baseURL}/locationHistory/{versionNumber}/history/position/{objectId}?key={Your_API_Key}'

Request parameters

The following table describes the parameters that can be used in a request.

  • Required parameters must be used or the call will fail.
  • Optional parameters may be used.
  • The order of request parameters is not important.

Note: There are no optional parameters in this endpoint.

Required parameters

Description

baseURL


string

The base URL for calling the API.


Value: api.tomtom.com

versionNumber


string

Service version.


Value: 1

key


string

An API Key valid for the requested service.


Value: Your valid API Key.

objectId


string

Object UUID for which the report is requested.


Value: A UUID.

Response data

Response body

The following JSON code block demonstrates a successful response from the API server.

Response body format - JSON
1{
2 "summary": {
3 "id": "object_id",
4 "name": "object_name"
5 },
6 "objectState": {
7 "type": "Feature",
8 "geometry": {
9 "type": "Point",
10 "coordinates": [longitude, latitude, altitude]
11 },
12 "estimatedSpeed": speed_value,
13 "estimatedDirection": azimuth,
14 "timestamp": "timestamp with time zone",
15 "userTimestamp": "timestamp with time zone"
16 }
17}

Response fields

The following table describes all of the response fields.

Primary fields

Field

Description

summary


object

A short summary about the requested object.

objectState


object

Contains information about the current state of the requested object.

summary object

Field

Description

id


string

UUID of an object for which this response is generated.

name


string

Name of an object for which this response is generated.

objectState object

Field

Description

type


string

In the current version this is always "Feature".

geometry


object

Object's position.

estimatedSpeed


float

Estimated speed of an object in the given time. Presented in km/h.

estimatedDirection


float

Estimated direction presented as a north-based azimuth. Presented in degrees.

timestamp


string

Recorded time as timestamp (ISO 8601 format).

userTimestamp


string

The date and time of the position being recorded by the user as a timestamp (ISO 8601 format).

geometry object

Field

Description

type


string

Type of geometry. In the current version this is always "Point".

coordinates


array(double)

Coordinates of the point in the form of an array containing (in this order): longitude, latitude, altitude. Altitude is optional.

Response codes

Code

Meaning & possible causes

200

OK

404

Not found :

  • No such object.
  • No position has been sent for object 'OBJECT_ID'.

Example

Get details of the current position of the 'Support car 1' object (id: cfde72d8-4b9f-4f6d-83c8-87ae0465fd5d).

Request URL example

get
Request URL example
https://api.tomtom.com/locationHistory/1/history/position/cfde72d8-4b9f-4f6d-83c8-87ae0465fd5d/position?key={Your_API_Key}

Response body example

Response body example - JSON
1{
2 "summary": {
3 "id": "fde72d8-4b9f-4f6d-83c8-87ae0465fd5d",
4 "name": "Support car 1"
5 },
6 "objectState": {
7 "type": "Feature",
8 "geometry": {
9 "type": "Point",
10 "coordinates": [4.8424672, 52.362239]
11 },
12 "estimatedSpeed": 59.4,
13 "estimatedDirection": 170,
14 "timestamp": "2019-06-04T13:30:00Z",
15 "userTimestamp": "2019-06-04T13:29:13Z"
16 }
17}