POST Devices / Events
Contents
Add events for a specific device
Endpoint URL:https://api.carnivalmobile.com/v6/devices/:device_id/events
Parameters
Path Parameters
Name | Type | Required | Definition |
---|---|---|---|
device_id | string | A Sailthru Mobile Device ID |
Body Parameters
Name | Type | Required | Definition |
---|---|---|---|
events | object | JSON object containing array of events |
Examples
# Basic Event
curl -X POST -u :$API_KEY -d '{"events":[{"name":"event_name", "date":"2016-09-11T18:04:23Z"}]}' -H "Content-Type:application/json" -H 'Accept: application/json' https://api.carnivalmobile.com/v6/devices/$device_id/events
# Basic Events (multiple)
curl -X POST -u :$API_KEY -d '{"events":[{"name":"event_name", "date":"2016-09-11T18:04:23Z"},{"name":"event_name_2", "date":"2016-09-11T19:04:23Z"}]}' -H "Content-Type:application/json" -H 'Accept: application/json' https://api.carnivalmobile.com/v6/devices/$device_id/events
# Basic Event (without date)
curl -X POST -u :$API_KEY -d '{"events":[{"name":"event_name"}]}' -H "Content-Type:application/json" -H 'Accept: application/json' https://api.carnivalmobile.com/v6/devices/$device_id/events
Result Format
202 Accepted
// your events have been successfully registered
{}
400 Bad Request
//your event data is not in the correct format
//common issues include: no event name, invalid event object, no events
{}
// This error is given when your API client credentials are not correct.
{
"error":"unauthorized"
}
/devices/events
endpoint would prepend Public Api:
to events when viewed in the web view. In v5, this behavior has been removed, but if your code depends on this, then you can use the /v4/devices/events/
endpoint.