List the fences for a given project

Service version: 1
Last edit: 2022.07.20

Purpose

This endpoint:

  • Obtains a list of tuples representing a user's fences for a given project.
  • Each tuple contains a single fence UUID and name.

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 format

GET
URL request example
https://{baseURL}/geofencing/{versionNumber}/projects/{projectId}/fences?key={Your_API_Key}

curl command format

GET
Request curl command example
curl 'https://{baseURL}/geofencing/{versionNumber}/projects/{projectId}/fences?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 parametersDescription
baseURL
string
The base URL for calling the API.
Value: api.tomtom.com
versionNumber
string
Service version number.
Value: 1
key
string
An API Key valid for the requested service.
Value: Your valid API Key.
projectId
string
The project id to gather details for.
Value: UUID

Response data

Response body

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

Response body - JSON
1{
2 "fences": [
3 {
4 "id": <fence_id>,
5 "name": <fence_name>
6 }
7 ...
8 ]
9}

Response fields

The following table describes all of the fields that can appear in a response.

Primary fields
FieldDescription
fences
array
The list of fences in a project.
fences array
FieldDescription
id
string
The UUID of the fence.
name
string
The fence's name.

Response codes

CodeMeaning & possible causes
200OK
404Not found: Project with the specified ID does not exist.

Example

List a fence for a given project

List all fences of the 'Cities in the Netherlands' (id: 44de824d-c368-46cf-a234-a6792682dfd6) project.

Request URL

GET
URL request example
https://api.tomtom.com/geofencing/1/projects/44de824d-c368-46cf-a234-a6792682dfd6/fences?key={Your_API_Key}

Response body

Response body - JSON
1{
2 "fences": [
3 {
4 "id": "f44405b40-5ebc-4aba-8f74-0b818d0a7e8a",
5 "name": "Amsterdam"
6 },
7 {
8 "id": "07c2994b-4f90-4bd5-95de-46b00bda28ed",
9 "name": "Utrecht"
10 },
11 {
12 "id": "30cf3728-5328-47d5-8a0f-91b2fca70fbb",
13 "name": "The Hague"
14 },
15 {
16 "id": "56d3887a-ac76-4089-9451-39d4ea340744",
17 "name": "Rotterdam"
18 }
19 ]
20}