Adding & Deleting Entities (Records)

Intro #

TrackZero uses what is known as Upsert (Update or Insert). Creating an Entity or updating it uses the same operation. This allows undeterministic creation of Entities (Or updating), which means you don’t have to remember the state of an Entity in order to determine whether you need to update or create.

Upsert an Entity #

Request Details
METHOD
POST
URL
https://api.trackzero.io/tracking/entities

Header Parameters: #

Key Value Description Data Type Required?
X-API-KEY
Your account API Key, for details on how to create an API Key, please check this document.
string
yes

X-API-VERSION

Target API Version. Do not include or use 1.0
string
no

QueryString Parameters: #

Key Value Description Data Type Required?
analyticsSpaceId

The Analytics Space Id to scope to. The entity will be added to this Analytics Space.

string
yes

Body (application/json): #

Key Value Description Data Type Required?
id
The id of the Entity you are trying to upsert. For example if you are trying to send a User object, this would be the user id.
string, number, guid/uuid
yes
type
The type of the Entity you are trying to send. For example if you are trying to store User infomraiton, this should be "Users". Similarly "Orders" for orders, "Customers" for customers...etc. We recommend using plural names as this will make it easier for your users to understand the entities.
string
yes
customAttributes
a Json Object that contains the additional attributes you want to include or update. The key can be any string but should NOT start with underscores `_`. Each Value can be of any of the following types (string, number, guid/uuid, boolean, dateTime, entity reference array). The entity reference object is a json object that must contain both id and type only.
Json Object keys: string values: string, number, guid/uuid, bool, entity reference.
no
autoGeography
a json object that contains the latitude and longitude. Adding this key to the request body will allow TrackZero to use these GeoPoints to translate them into Country & State and enable Map Charting for this specific entity type.
"AutoGeography": { "GeoPoint": { "Latitude": 52.51059, "Longitude": -2.17762 }
no

Sample Json Body: #

				
					{
   "id": 7315,
   "type": "Orders",
   "customAttributes": {
      "Time": "2020-07-26T16:11:49-05:00",
      "Total Value": "749.18"
   }
}
				
			

Sample Json body with Entity References: #

				
					{
    "id": 7315,
    "type": "Orders",
    "customAttributes": {
        "Time": "2020-07-26T16:11:49-05:00",
        "Total Value": "749.18",
        "Items": [ // Entity References.
        { 
            "id": 395,
            "type":"Products"
        },
        {
            "id": 36,
            "type": "Products"
        }]
     
   }
}
				
			

Sample Json body with Entity References & Auto Geography: #

				
					{
    "id": 7315,
    "type": "Orders",
    "customAttributes": {
        "Time": "2020-07-26T16:11:49-05:00",
        "Total Value": "749.18",
        "Items": [ // Entity References.
        { 
            "id": 395,
            "type":"Products"
        },
        {
            "id": 36,
            "type": "Products"
        }]
     
   },
   "autoGeography": {
		"GeoPoint": {
			"Latitude": 52.51059,
			"Longitude": -2.17762
		}
	}
}
				
			

Delete an Entity #

Request Details
METHOD
DELETE
URL
https://api.trackzero.io/tracking/entities

Header Parameters: #

Key Value Description Data Type Required?
X-API-KEY
Your account API Key, for details on how to create an API Key, please check this document.
string
yes

X-API-VERSION

Target API Version. Do not include or use 1.0
string
no

QueryString Parameters: #

Key Value Description Data Type Required?
analyticsSpaceId

The Analytics Space Id to scope to. The entity (if exists) will be deleted from this Analytics Space.

string
yes

Body (application/json): #

Key Value Description Data Type Required?
id
The id of the Entity you are trying to delete. For example if you are trying to delete a User object, this would be the user id.
string, number, guid/uuid
yes
type
The type of the Entity you are trying to delete.
string
yes

Sample Json Body: #

				
					{
   "id": 7315,
   "type": "Orders"
}