Delete projects

Service version: 1
Last edit: 2022.09.01

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 request format

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

curl command request format

delete
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

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 parameters

Description

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 format - 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

Field

Description

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

Field

Description

id
string

UUID of a fence.

name
string

Name of a fence.

removedRelationsToFences array

Field

Description

id
string

UUID of an object.

name
string

Name of an object.

Response codes

Code

Meaning & possible causes

200

OK (for dry run mode)
Deleted

403

Forbidden:

  • Provided Admin Key is invalid.
  • Admin Key is missing.

404

Not Found: Project with the specified id does not exist.

Example

Delete projects

Request URL example

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 example

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