Events
If you wish to capture custom activity that you want to log to the twin’s timeline, you have the option to create custom event(s). Each event will produce an ID with a corresponding timestamp that will be logged to the timeline.
An event includes a name, category, and any custom data attributes you wish to collect or capture.
Update an event on the timeline
Delete an event on the timeline
§Add an event to the timeline
To add an event to the timeline, you can POST a request similar to the following:
curl --location --request POST '<API_URL>/events/' \
--header 'Content-Type: application/vnd.api+json' \
--header 'X-Organization: <ORG_ID>' \
--header 'X-Twin: <TWIN_ID>' \
--header 'Authorization: Token <ACCESS_TOKEN>'
--data-raw '{
"data": {
"type": "events",
"attributes": {
"name": "Purchase",
"category": "Transaction",
"data": {
"Price" : “$4.99”,
“Notes” : “Bought a coffee at Bluebottle”
}
}
}
}
§Update an event on the timeline
To edit or update an event already on the timeline, you can PATCH a request similar to the following:
curl --location --request PATCH '<API_URL>/events/<EVENT_ID>' \
--header 'Content-Type: application/vnd.api+json' \
--header 'X-Organization: <ORG_ID>' \
--header 'X-Twin: <TWIN_ID>' \
--header 'Authorization: Token <ACCESS_TOKEN>'
--data-raw '{
"data": {
"type": "events",
“id” : “<EVENT_ID>”
"attributes": {
"data": {
"Price" : “$6.99”,
}
}
}
}
§Delete an event on the timeline
To delete an existing custom event on the timeline, you can send a DELETE request as shown below:
curl --location --request DELETE '<API_URL>/events/<EVENT_ID>' \
--header 'Content-Type: application/vnd.api+json' \
--header 'X-Organization: <ORG_ID>' \
--header 'X-Twin: <TWIN_ID>' \
--header 'Authorization: Token <ACCESS_TOKEN>'
--data-raw '{
"data": {
"type": "events",
“id” : “<EVENT_ID>”
}
}