POST Users / Events

Endpoint URL: https://api.carnivalmobile.com/v6/users/user_id/events

Parameters

Path Parameters

Name Type Required Definition
user_id string A Sailthru Mobile user ID

Body Parameters

Name Type Required Definition
events object JSON object containing array of events

Examples

Basic Event

Copy
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/users/$user_id/events

Multiple Events

Copy
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/users/:user_id/events

Events without a specific date

Copy
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/users/:user_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"}

Notes

     
  • The date property on an event is optional and if left off UTC time will be used in its place.
  • In versions prior to v5, the /users/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/users/events/ endpoint.
  • POSTing an event to a user with multiple devices will cause the event to be attributed to each and every device associated with the requested user_id. Dates should be formatted using an ISO 6801 formatted string.