Sorry, you need to enable JavaScript to visit this website.

Get objects count in the fence

 

Service version: 1
Last edit: 2020.08.12

On this page

Purpose

This endpoint list objects inside the fence.

Request data

HTTPS method: GET

URL format

For ease of viewing and identification:

  • Required constants and parameters are shown in bold text.
  • Optional parameters are shown in plain text.
https://baseURL/geofencing/versionNumber/fences/fenceId/objects?key=Your_API_Key[&filters=property:value][&maxResults=integer][&pageNumber=integer]

curl command

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.
  • If there is a default value – that will be assumed when an optional parameter is not used, it is shown in the table.
  • The order of Request parameters is not important.
  • The maximum allowed time between provided timestamps is 24h.
Required parameters
Parameter 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
[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
Operators
Operator name Usage Explanation Example
Equals <property_name>:<property_value> Select only objects with property <property_name> set to value <property_value> color:blue

▲ Return to top

Response data

Response body

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

{
    "summary":{
        "id":"fence_id",
        "name":"fence_name"
    },
    "objects":[
        {
        "id":"object_uuid",
        "name":"object_name"
        }
    ],
    "totalObjectsCount":"number",
    "resultInfo":{
        "maxResults":"number",
        "pageNumber":"number",
        "itemsCount":"number"
    }
}

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(object)
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.

▲ Return to top

HTTP 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.

▲ Return to top

Examples

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

Request URL

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

Response body (JSON)

{
    "summary":{
        "id":"66080bab-d69d-420a-ac2b-90c71894ac8f",
        "name":"House"
    },
    "objects":[
        {
        "id":"299c4fc7-a611-46a3-9d03-7b3966f225ba",
        "name":"Drone #1"
        }
    ],
    "totalObjectsCount":1,
    "resultInfo":{
        "maxResults":100,
        "pageNumber":1,
        "itemsCount":1
    }
}

▲ Return to top