Delete projects

Service version: 1
Last edit: 2022.07.20

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.

  1. Delete every fence that only exist in the project being deleted; relationships are also removed.
  2. Remove relations to fences that exist in other projects.
  3. Remove relations to objects that have the deleted project set as their default project.
  4. 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 format

DELETE
URL request example
https://{baseURL}/geofencing/{versionNumber}/projects/{projectId}?key={Your_API_Key}&adminKey={Your_Admin_Key}&dryRun={true/false}

curl command format

DELETE
Request curl command example
curl -XDELETE 'https://{baseURL}/geofencing/{versionNumber}/projects/{projectId}?key={Your_API_Key}&adminKey={Your_Admin_Key}&dryRun={true/false}'

Request parameters

Required parametersDescription
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.
projectId
string
The unique ID of a project to delete.
Value: A UUID
Optional parametersDescription
dryRun
boolean
Simulates project removal without actually deleting anything. The service sends the response containing fences that would be cascade-removed.
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 - JSON
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
FieldDescription
name
string
Name of the project.
id
string
UUID of the project.
dryRun
boolean
Indicates if the output is for a non-delete request (true), or the changes were actually made (false).
deletedFences
array
(Optional) A list of UUIDs and names of fences that were deleted, because a deleted project is their only linked project.
removedRelationsToFences
array
(Optional) A list of UUIDs and names of fences that remain in the system, but are unlinked from deleted project.
removedRelationsToObjects
array
(Optional) A list of UUIDs and names of objects that lost their default project, because deleted project was their default project.
deletedFences array
FieldDescription
id
string
UUID of a fence.
name
string
Name of a fence.
removedRelationsToFences array
FieldDescription
id
string
UUID of an object.
name
string
Name of an object.

Response codes

CodeMeaning & possible causes
200OK (for dry run mode)
Deleted
403Forbidden:
  • Provided Admin Key is invalid.
  • Admin Key is missing.
404Not Found: Project with the specified id does not exist.

Example

Delete projects

Request URL

DELETE
URL request 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

Response body - JSON
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}