Get objects count in the fence

Service version: 1
Last edit: 2022.09.01

Purpose

This endpoint list objects inside the fence.

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}/geofencing/{versionNumber}/fences/{fenceId}/objects?key={Your_API_Key}&filters={property:value}&maxResults={integer}&pageNumber={integer}

curl command request format

get
curl command request format
curl 'https://{baseURL}/geofencing/{versionNumber}/fences/{fenceId}/objects?key={Your_API_Key}&filters={property:value}&maxResults={integer}&pageNumber={integer}'

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.
  • The maximum allowed time between provided timestamps is 24h.

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.

fenceId
string

The fence id to gather details for.
Value: A UUID.

Optional parameters

Description

filters
string

Only used to select objects whose properties comply with the filter.
Value: The string following syntax rules.
Default: No filtering

maxResults
integer

Maximum number of items returned in the response.
Value: Greater than zero, less than or equal to 100.
Default: 100

pageNumber
integer

The number of the items page to be returned in the response. The maximum number of elements on the page is equal to the maxResults value.
Value: Greater than zero.
Default: 1

Filters

Filters have their own syntax as described in the following table. Nested objects are not supported.

objectProperty:value

Operator name

Usage

Explanation

Example

Equals

<property_name>:<property_value>

Select only objects with property <property_name> set to value <property_value>

color:blue

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": "fence_id",
4 "name": "fence_name"
5 },
6 "objects": [
7 {
8 "id": "object_uuid",
9 "name": "object_name"
10 }
11 ],
12 "totalObjectsCount": "number",
13 "resultInfo": {
14 "maxResults": "number",
15 "pageNumber": "number",
16 "itemsCount": "number"
17 }
18}

Response fields

The following table describes all of the response fields.

Primary fields

Field

Description

summary
object

Contains information about the list objects in the fence request.

objects
array (of objects)

An array of objects located in the fence.

totalObjectsCount
integer

The number of the objects inside the fence.

resultInfo
object

Contains information about response paging.

summary object

Field

Description

id
string

UUID of a fence for which this report is generated.

name
string

The name of a fence for which this report is generated.

object object

Field

Description

id
UUID

UUID of the object which is inside the fence.

name
string

The name of the object.

resultInfo object

Field

Description

maxResults
integer

Maximum number of items returned in the response.

pageNumber
integer

Number of the items page to be returned in the response. Maximum number of elements on the page is equal to the maxResults value.

itemsCount
integer

Number of returned items on the page.

Response codes

Code

Meaning & possible causes

200

OK

400

Bad Request:

  • Filter syntax is incorrect.
  • The value of parameter is not a positive decimal number.

404

Not found: No such fence.

Example

Get objects count in the fence. Get the object number of the 'House' fence** (id: 66080bab-d69d-420a-ac2b-90c71894ac8f) and with property 'type' and value 'drone'.

URL rerquest example

get
URL request example
https://api.tomtom.com/geofencing/1/fences/66080bab-d69d-420a-ac2b-90c71894ac8f/objects?key={Your_API_Key}&filters=type:drone

Response body example

Response body - JSON
1{
2 "summary": {
3 "id": "66080bab-d69d-420a-ac2b-90c71894ac8f",
4 "name": "House"
5 },
6 "objects": [
7 {
8 "id": "299c4fc7-a611-46a3-9d03-7b3966f225ba",
9 "name": "Drone #1"
10 }
11 ],
12 "totalObjectsCount": 1,
13 "resultInfo": {
14 "maxResults": 100,
15 "pageNumber": 1,
16 "itemsCount": 1
17 }
18}