Add new object

Service version: 1
Last edit: 2022.07.20

Purpose

This endpoint creates a new object.

Request data

HTTPS method: POST

  • 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

POST
Request example
https://{baseURL}/geofencing/{versionNumber}/objects/object?key={Your_API_Key}&adminKey={Your_Admin_Key}

curl command format

POST
Request curl command
1curl -v -XPOST -H "Content-type: application/json" -d
2'{
3 "name": "object_name",
4 "defaultProject": "project_id",
5 "properties": {
6 "key": "value"
7 ...
8 }
9 }'
10'https://{baseURL}/geofencing/{versionNumber}/objects/object?key={Your_API_Key}&adminKey={Your_Admin_Key}'

POST request body

POST
POST request body example - JSON
1{
2 "name": "object_name",
3 "defaultProject": "project_id",
4 "properties": {
5 "key": "value"
6 ...
7 }
8}

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.

Note: There are no optional parameters in this endpoint.

Required parametersDescription
baseURL
string
The base URL for calling the API.
Value: api.tomtom.com
versionNumber
string
Service version.
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.

Response data

Response body

Response body - JSON
1{
2 "name": "object_name",
3 "id": "object_id",
4 "defaultProject": "project_id",
5 "properties": {
6 "key": "value"
7 ...
8 }
9}

Response fields

The following table describes all of the fields that can appear in a response.

Primary fieldsDescription
name
string
The name of the object.
id
string
The UUID of the object.
defaultProject
string
(Optional) The UUID of the object's default project.
properties
object
(Optional) It is an object containing the user-defined properties of the fence. Its content varies between fences.

Response codes

CodeMeaning & possible causes
201Created
400Bad request:
  • Object with the given name already exists.
  • Selected default project does not exist.
403Forbidden:
  • Provided Admin Key is invalid.
  • Admin Key is missing.

Example

Add a new object

Request URL

POST
Request URL example
https://api.tomtom.com/geofencing/1/objects/object?key={Your_API_Key}&adminKey={Your_Admin_Key}

POST request body

POST
POST request body - JSON
1{
2 "name": "Support car 1",
3 "defaultProject": "4dee65b0-bd0a-47fd-ad12-27231fd780fb",
4 "properties": {
5 "embeddedId": "EL 11111",
6 "maxSpeedKmh": 70,
7 "driver": "John Doe"
8 }
9}

Response body

Response body - JSON
1{
2 "name": "Support car 1",
3 "id": "cfde72d8-4b9f-4f6d-83c8-87ae0465fd5d",
4 "defaultProject": "4dee65b0-bd0a-47fd-ad12-27231fd780fb",
5 "properties": {
6 "embeddedId": "EL 11111",
7 "maxSpeedKmh": 70,
8 "driver": "John Doe"
9 }
10}