Delete projects
Purpose
This endpoint uses a command to delete projects.
- Delete is a cascade action, as no fence can exist without a project.
- if any fence would violate this rule after deleting a project, it will also be deleted.
- Information about all deleted fences will be sent in the response.
Additional response fields
-
deletedFences
array- A response field containing all deleted fences.
- Fences that are assigned to the project being deleted, but which also have a relationship to other projects, are not deleted.
- Only their relationship to the deleted project is removed.
-
removedRelationsToFences
array- A response field containing all fences which are not deleted, but whose relationship to the deleted project is deleted.
-
removedRelationsToObjects
array- A response field containing all objects which are not deleted, but whose relationship to the deleted project is deleted.
- Unlike fences, objects can exist without a default project.
- So, deleting their default project does not automatically delete them.
The delete command can also be used in dry run mode, which removes nothing, but sends information about cascade removals in the response.
Project deletion takes place via the following steps.
- Delete every fence that only exist in the project being deleted relationships are also removed.
- Remove relations to fences that exist in other projects.
- Remove relations to objects that have the deleted project set as their default project.
- Delete the project.
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 request format
https://{baseURL}/geofencing/{versionNumber}/projects/{projectId}?key={Your_API_Key}&adminKey={Your_Admin_Key}&dryRun={true/false}
curl command request format
curl -XDELETE 'https://{baseURL}/geofencing/{versionNumber}/projects/{projectId}?key={Your_API_Key}&adminKey={Your_Admin_Key}&dryRun={true/false}'
Request parameters
Required parameters | Description |
---|---|
| The base URL for calling the API. |
| Service version number. |
| An API Key valid for the requested service. |
| An Admin Key valid for the provided API Key. |
| The unique ID of a project to delete. |
Optional parameters | Description |
---|---|
| Simulates project removal without actually deleting anything. The
service sends the response containing fences that would be
cascade-removed. |
Response data
Response body
The following JSON code block demonstrates a successful response from the API server.
1{2 "name": project_name",3 "id": "project_id",4 "dryRun" : true/false,5 "deletedFences": [6 {7 "id": "dfence_1_id",8 "name": "dfence_1_name"9 }, ...10 ]11 "removedRelationsToFences": [12 {13 "id": "rfence_1_id",14 "name": "rfence_1_name"15 }, ...16 ]17 "removedRelationsToObjects": [18 {19 "id": "object_1_id",20 "name": "object_1_name"21 }, ...22 ]23}
Response fields
The following table describes all of the response fields.
Primary fields | |
---|---|
Field | Description |
| Name of the project. |
| UUID of the project. |
| Indicates if the output is for a non-delete request (true), or the changes were actually made (false). |
| (Optional) A list of UUIDs and names of fences that were deleted, because a deleted project is their only linked project. |
| (Optional) A list of UUIDs and names of fences that remain in the system, but are unlinked from deleted project. |
| (Optional) A list of UUIDs and names of objects that lost their default project, because deleted project was their default project. |
deletedFences array | |
Field | Description |
| UUID of a fence. |
| Name of a fence. |
removedRelationsToFences array | |
Field | Description |
| UUID of an object. |
| Name of an object. |
Response codes
Code | Meaning & possible causes |
---|---|
| OK (for dry run mode) |
| Forbidden:
|
| Not Found: Project with the specified id does not exist. |
Example
Delete projects
Request URL example
https://api.tomtom.com/geofencing/1/projects/44de824d-c368-46cf-a234-a6792682dfd6?key={Your_API_Key}&adminKey={Your_Admin_Key}&dryRun=true
Response body example
1{2 "name": "Airports in Germany",3 "id": "44de824d-c368-46cf-a234-a6792682dfd6",4 "dryRun": true,5 "deletedFences": [6 {7 "id": "5613e12e-6bc3-40c0-bc99-eaf0e4872e1e",8 "name": "Fence2"9 },10 {11 "id": "f0f159af-65bb-445c-a4db-40134f52fc35",12 "name": "Fence1"13 }14 ],15 "removedRelationsToFences": [16 {17 "id": "aa134406-fa3a-488e-8817-a9865e46e5a0",18 "name": "Fence3"19 }20 ],21 "removedRelationsToObjects": [22 {23 "id": "8d4b0d1b-1dd1-46eb-9c34-817759403746",24 "name": "Object1"25 },26 {27 "id": "5ffd4407-a15b-460f-bf8b-54028725d177",28 "name": "Object2"29 }30 ]31}