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

Get fence details

 

Service version: 1
Last edit: 2019.09.18

On this page

Purpose

This endpoint requests all details for a single fence.

Request format

HTTPS method: GET

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?key=Your_API_Key

curl command

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.
  • 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.
Required parameters
Parameter 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
Parameter 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

▲ Return to top

Response data

Response body

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

{
  "name": "fence_name",
  "id": "fence_id",
  "type": "Feature",
  "geometry": {
    "radius": radius_in_meters,
    "type": "Point",
    "shapeType": "shape_type",
    "coordinates": ["longitude", "latitude"]
  },
  "properties": {
    "key": "value"
  }
}

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

▲ Return to top

HTTP Response codes

Code Meaning and possible causes
200 OK
404 Not Found: Fence with the specified id does not exist.

Examples

Get details of the 'Amsterdam Airport Schiphol' (id: a334029d-3003-43d6-adf8-de0b7e35b6cb) fence.

Request URL

https://api.tomtom.com/geofencing/1/fences/a334029d-3003-43d6-adf8-de0b7e35b6cb?key=Your_API_Key

Response body

{
  "name": "Amsterdam Airport Schiphol",
  "id": "aaab6d78-1738-45bd-a78b-ff3a7ba839f3",
  "type": "Feature",
  "geometry": {
    "radius": 75,
    "type": "Point",
    "shapeType": "Circle",
    "coordinates": [-67.137343, 45.137451]
  },
  "properties": {
    "type": "NO_FLY_ZONE",
    "lastUpdated": "2018-10-11T23:28:56.782Z"
  }
}

▲ Return to top

You are here