Get fence details

Service version: 1
Last edit: 2022.09.01

Purpose

This endpoint requests all details for a single 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}?key={Your_API_Key}

curl command request format

get
curl command request format
curl 'https://{baseURL}/geofencing/{versionNumber}/fences/{fenceId}?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.

Required parameters

Description

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.

fenceId
string

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

Optional parameters

Description

showGeoJson
boolean

If set to true, the output contains a GeoJSON representation of a custom fence shape.
For fences that are already defined as GeoJSON, this parameter changes nothing.
Default value: false
Other value: true

Response data

Response body

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

Response body format - JSON
1{
2 "name": "fence_name",
3 "id": "fence_id",
4 "type": "Feature",
5 "geometry": {
6 "radius": radius_in_meters,
7 "type": "Point",
8 "shapeType": "shape_type",
9 "coordinates": ["longitude", "latitude"]
10 },
11 "properties": {
12 "key": "value"
13 }
14}

Response fields

The following data tables describe all of the fields that can appear in a response. Fields are listed by the response section they belong to and in the order that they appear in the response.

Primary fields

Description

name
string

Name of the fence.

type
string

In the current version it is always "Feature".

geometry
object

An object that describes fence geometry. See the Custom fence shapes section.

properties
object

(Optional) An object containing user-defined properties of the fence. It's content varies between fences.

Response codes

Code

Meaning & possible causes

200

OK

404

Not Found: Fence with the specified id does not exist.

Example

Get fence details

URL request example

get
URL request example
https://api.tomtom.com/geofencing/1/fences/a334029d-3003-43d6-adf8-de0b7e35b6cb?key={Your_API_Key}

Response body example

Response body example - JSON
1{
2 "name": "Amsterdam Airport Schiphol",
3 "id": "aaab6d78-1738-45bd-a78b-ff3a7ba839f3",
4 "type": "Feature",
5 "geometry": {
6 "radius": 75,
7 "type": "Point",
8 "shapeType": "Circle",
9 "coordinates": [-67.137343, 45.137451]
10 },
11 "properties": {
12 "type": "NO_FLY_ZONE",
13 "lastUpdated": "2018-10-11T23:28:56.782Z"
14 }
15}