POST Devices / Events

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

Copy
# 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

Copy
// your events have been successfully registered
{}

400 Bad Request

Copy
//your event data is not in the correct format
//common issues include: no event name, invalid event object, no events
{}

401 Unauthorized

Copy
// This error is given when your API client credentials are not correct. 
{
  "error":"unauthorized"}

Note 1: the date property on an event is optional and if left off UTC time will be used in its place. Dates should be formatted using an ISO 6801 formatted string.

Note 2: In versions prior to v5, the /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.