Edit fence
Purpose
The Edit fence endpoint provides new values for fence attributes. An Admin may only send the values that need to be updated.
Request data
HTTP method: PUT
- 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
https://{baseURL}/geofencing/{versionNumber}/fences/{fenceId}?key={Your_API_Key}&adminKey={Your_Admin_Key}
curl command request format
1curl -XPUT -H "Content-type: application/json" -d '{2 "name": "fence_name","type": "Feature",3 "projects": ["project_1_id", ... , "project_N_id"],4 "geometry": {5 "radius": radius_in_meters,6 "type": "Point",7 "shapeType": "shape_type",8 "coordinates": [longitude, latitude]9 },10 "properties": {11 "key": "value"12 }13}'14'https://{baseURL}/geofencing/{versionNumber}/fences/{fenceId}?key={Your_API_Key}&adminKey={Your_Admin_Key}'
PUT request body format
1{2 "name": "fence_name","type": "Feature",3 "projects": ["project_1_id", ... , "project_N_id"],4 "geometry": {5 "radius": radius_in_meters,6 "type": "Point",7 "shapeType": "shape_type",8 "coordinates": [longitude, latitude]9 },10 "properties": {11 "key": "value"12 }13}
PUT body request fields
| Field name | Description | 
|---|---|
| 
 | Unique name | 
| 
 | A list of projects (array), it has to contain at least one entry. 
 Value: A list (array) of projects containing at least one entry. | 
| 
 | Fence geometry: An Admin has to provide the whole block, not only the
edited attributes. | 
| 
 | All properties are updated. 
 Value: All properties. | 
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 | 
|---|---|
| 
 | The base URL for calling the API. | 
| 
 | Service version number. | 
| 
 | The Id of the fence to edit. | 
| 
 | An API Key valid for the requested service. | 
| 
 | An Admin key valid for the provided API key. | 
| Optional parameters | Description | 
|---|---|
| 
 | If set to   | 
Response data
Response body
1{2 "name": "fence_name",3 "id": "fence_id",4 "type": "Feature",5 "projects":6 [7 {8 "project_1_id",9 "project_1_name"10 },11 {12 "project_N_id",13 "project_N_name"14 }15 ],16 "geometry": {17 "radius": radius_in_meters,18 "type": "Point",19 "shapeType": "shape_type",20 "coordinates": [longitude, latitude]21 },22 "properties": {23 "key": "value"24 }25}
Response fields
The following table describes all of the response fields.
| Primary fields | |
|---|---|
| Field | Description | 
| 
 | Name of the fence. | 
| 
 | UUID of the fence. | 
| 
 | In the current version it is always "Feature". | 
| 
 | The list of projects the fence is assigned to. | 
| 
 | An object that describes fence geometry. See the Custom fence shapes section. | 
| 
 | (Optional) An object containing user-defined properties of the fence. It's content varies between fences. | 
| projects array | |
| Field | Description | 
| 
 | UUID of a project. | 
| 
 | Name of a project. | 
Response codes
| Code | Meaning & possible causes | 
|---|---|
| 
 | OK | 
| 
 | Bad request: 
 | 
| 
 | Forbidden: 
 | 
| 
 | Not found: 
 | 
Example
Edit a fence
URL request example
https://api.tomtom.com/geofencing/1/fences/aaab6d78-1738-45bd-a78b-ff3a7ba839f3?key={Your_API_Key}&adminKey={Your_Admin_Key}
PUT request body example
1{2 "name": "No-fly zone",3 "properties": {4 "maxAmountOfCars": 105 }6}
Response body example
1{2 "name": "No-fly zone",3 "id": "aaab6d78-1738-45bd-a78b-ff3a7ba839f3",4 "type": "Feature",5 "projects":6 [7 {8 "131db271-752e-4462-bd7a-ac948864110e",9 "No-fly zone project"10 },11 {12 "00220d17-eef6-4554-8e59-ec778eddc552",13 "No-fly zone project #2"14 }15 ],16 "geometry": {17 "radius": 75,18 "type": "Point",19 "shapeType": "Circle",20 "coordinates": [-67.137343, 45.137451]21 },22 "properties": {23 "maxAmountOfCars": 1024 }25}