Skip to main content

Custom events

Send custom data generated from a device registered using the Register source endpoint.

URL

POST /v1/sessions/:sessionId/events

Request URL Parameters

ParameterDescription
:sessionIdID of the session to add events.
:sourceIdID of the source which generates the event.

Request Body

time
number
Required
Time in seconds since the beginning of the session this event occurred.
data
any
Required
Data captured by the device. Must match registered device format. Below the different formats are described.
data (scalar)
number
Data when format is scalar. A single numeric value.
data (text)
string
Data when format is text. An string.

Response Body

Created events

time
number
Time in seconds since the beginning of the session this event occurred.
Example: 2.5
data
string
Data of the event. Always matches device registered format.
Example: 23
source
string
ID of the registered source which generated this event.
Example: eff2e60e-36c1-411f-bd7c-a3ebba93933f
session
string
ID of the session this event belongs to.
Example: 67070291909517eb52549eb7
user
string
ID of the user who registered the event.
Example: 61f8092b77514d00166d8172
type
string
Type of the event. Currently, will always be `sensor_report` for events registered with this endpoint
Example: sensor_report

Response codes

CodeMeaningDescription
201CreatedThe request has been fulfilled and a new resource was created.
400Bad RequestServer received an invalid request body or invalid query parameters.
404Not FoundThe requested resource does not exist or you do not have permissions to perform this action on it.

Request example

curl -X POST 'https://api.emogg.com/v1/sessions/:sessionId/events' \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Content-Type: application/json'
-d '{"time":2.5,"data":23}'

Example response

[
{
"time": 2.5,
"data": 23,
"source": "eff2e60e-36c1-411f-bd7c-a3ebba93933f",
"session": "67070291909517eb52549eb7",
"user": "61f8092b77514d00166d8172",
"type": "sensor_report"
},
{...},
{...}
]