Delete fence
Purpose
This endpoint provides a command used to delete fences.
- Information about all affected projects will be sent in the response.
- The delete command can also be used in dry run mode, which removes nothing but sends information about affected projects in the response.
Request data
HTTPS method: DELETE
- 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
DELETE
URL request example
https://{baseURL}/geofencing/{versionNumber}/fences/{fenceId}?key={Your_API_Key}&adminKey={Your_Admin_Key}&dryRun={true/false}
curl command format
DELETE
Request curl command example
curl -v -XDELETE -H 'https://{baseURL}/geofencing/{versionNumber}/fences/{fenceId}?key={Your_API_Key}&adminKey={Your_Admin_Key}&dryRun={true/false}'
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 . |
adminKey string | An Admin key valid for the provided API key. Value: Your valid Admin Key . |
fenceId string | The fence id to delete. Value: A fence id. |
Optional parameters | Description |
---|---|
dryRun boolean | Simulates fence removal without actually deleting anything. The service just sends the response, containing the affected projects. Default value: false Other value: true |
Response data
Response body
Response body - JSON
1{2 "name": "fence_name",3 "id": "fence_id",4 "dryRun" : true/false,5 "affectedProjects": [6 {7 "id" : project_1_id,8 "name" : project_1_name9 },10 ... ,11 {12 "id" : project_N_id,13 "name" : project_N_name14 }15 ]16}
Response fields
The following data tables describe all of the fields that can appear in a response.
Primary fields | |
---|---|
Field | Description |
name string | The name of the fence. |
id string | The UUID of the fence. |
dryRun boolean | Indicates if the output is for the non-delete request (true), or the changes were actually made (false). |
affectedProjects array | (Optional) The list of projects from which the fence was unlinked. |
affectedProjects array | |
Field | Description |
id string | The UUID of a project. |
name string | The name of a project. |
Response codes
Code | Meaning & possible causes |
---|---|
200 | OK (for dry run mode) Deleted |
403 | Forbidden:
|
404 | Not found: Fence with the specified id does not exist. |
Example
Delete a fence
Request URL
DELETE
URL request example
https://api.tomtom.com/geofencing/1/fences/aaab6d78-1738-45bd-a78b-ff3a7ba839f3?key={Your_API_Key}&adminKey={Your_Admin_Key}&dryRun=true
Response body
Response body - JSON
1{2 "name": "No-fly zone 23",3 "id": "aaab6d78-1738-45bd-a78b-ff3a7ba839f3",4 "dryRun": true,5 "affectedProjects": [6 {7 "id": "65f88b21-63f8-4dc9-8e5a-330523c57f55",8 "name": "Project 1 Name"9 },10 {11 "id": "6608a5c5-d9e8-4589-acb8-1d5bba02b3f8",12 "name": "Project 2 Name"13 }14 ]15}