Custom events
Send custom data generated from a device registered using the Register source endpoint.
URL
POST /v1/sessions/:sessionId/events
Request URL Parameters
| Parameter | Description |
|---|---|
| :sessionId | ID of the session to add events. |
| :sourceId | ID 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.5data
string
Data of the event. Always matches device registered format.
Example:
23source
string
ID of the registered source which generated this event.
Example:
eff2e60e-36c1-411f-bd7c-a3ebba93933fsession
string
ID of the session this event belongs to.
Example:
67070291909517eb52549eb7user
string
ID of the user who registered the event.
Example:
61f8092b77514d00166d8172type
string
Type of the event. Currently, will always be `sensor_report` for events registered with this endpoint
Example:
sensor_reportResponse codes
| Code | Meaning | Description |
|---|---|---|
| 201 | Created | The request has been fulfilled and a new resource was created. |
| 400 | Bad Request | Server received an invalid request body or invalid query parameters. |
| 404 | Not Found | The 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"
},
{...},
{...}
]