{"_id":"5b1f2cbdfd653400031d8d87","version":{"_id":"5b1f2cbdfd653400031d8d9f","project":"55e67aaa9cc7c62b00c4a1ea","__v":0,"forked_from":"55e67aab9cc7c62b00c4a1ed","createdAt":"2015-09-02T04:27:23.612Z","releaseDate":"2015-09-02T04:27:23.612Z","categories":["5b1f2cbdfd653400031d8d42","5b1f2cbdfd653400031d8d43","5b1f2cbdfd653400031d8d44","5b1f2cbdfd653400031d8d45","5b1f2cbdfd653400031d8d46","561c61b4ad272c0d00a892df","586c014c0abf1d0f000d04d4","58991d2ad207df0f0002186b","5b1f2cbdfd653400031d8d47","5b1f2cbdfd653400031d8d48","5af0fe494ca2730003cbc98a","5af0fe55ec80af0003804ca2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"rebrand","version_clean":"1.3.0","version":"1.3"},"category":{"_id":"5b1f2cbdfd653400031d8d44","__v":20,"pages":["5b1f2cbdfd653400031d8d59","55ed079b0d968e2100de8339","5b1f2cbdfd653400031d8d5a","55ed0bb078319821005005cf","5b1f2cbdfd653400031d8d5b","5b1f2cbdfd653400031d8d5c","5b1f2cbdfd653400031d8d5d","5b1f2cbdfd653400031d8d5e","5b1f2cbdfd653400031d8d5f","5b1f2cbdfd653400031d8d60","5b1f2cbdfd653400031d8d61","5b1f2cbdfd653400031d8d62","5b1f2cbdfd653400031d8d63","5b1f2cbdfd653400031d8d64","5b1f2cbdfd653400031d8d65","5b1f2cbdfd653400031d8d66","5b1f2cbdfd653400031d8d67","5b1f2cbdfd653400031d8d6f","5b1f2cbdfd653400031d8d70","5b1f2cbdfd653400031d8d78"],"project":"55e67aaa9cc7c62b00c4a1ea","version":"5b1f2cbdfd653400031d8d9f","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-09-02T04:30:21.948Z","from_sync":false,"order":5,"slug":"rest-api","title":"REST API"},"__v":6,"parentDoc":null,"user":"57e9c9dc80c0490e00480948","project":"55e67aaa9cc7c62b00c4a1ea","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-03T00:38:53.638Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"post","results":{"codes":[{"language":"json","status":202,"name":"","code":"// your events have been successfully registered\n{}"},{"name":"","code":"//your event data is not in the correct format\n//common issues include: no event name, invalid event object, no events\n{}","language":"json","status":400},{"code":"// This error is given when your API client credentials are not correct. \n{\n  \"error\":\"unauthorized\"\n}","language":"text","status":401}]},"settings":"","examples":{"codes":[{"language":"curl","code":"# Basic Event\ncurl -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/v5/users/:user_id/events\n\n# Basic Events (multiple)\ncurl -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/v5/users/:user_id/events\n\n# Basic Event (without date)\ncurl -X POST -u :API_KEY -d '{\"events\":[{\"name\":\"event_name\"}]}' -H \"Content-Type:application/json\" -H 'Accept: application/json' https://api.carnivalmobile.com/v5/users/:user_id/events\n"}]},"auth":"required","params":[{"_id":"57f2c04f89faf32b004f8329","ref":"","in":"path","required":false,"desc":"A Carnival user ID","default":"","type":"string","name":"user_id"},{"_id":"57f2c04f89faf32b004f8328","ref":"","in":"body","required":false,"desc":"JSON object containing array of events","default":"","type":"object","name":"events"}],"url":"/users/user_id/events"},"isReference":true,"order":9,"body":"**Note 1:** the date property on an event is optional and if left off UTC time will be used in its place.\n\n**Note 2:** 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.\n\n**Note 3:** 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**.\n\nDates should be formatted using an [ISO 6801](https://en.wikipedia.org/wiki/ISO_860) formatted string.","excerpt":"","slug":"users-events","type":"endpoint","title":"Users / Events"}

postUsers / Events


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

user_id:
string
A Carnival user ID

Body Params

events:
object
JSON object containing array of events

Examples


Result Format


Documentation

**Note 1:** the date property on an event is optional and if left off UTC time will be used in its place. **Note 2:** 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. **Note 3:** 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](https://en.wikipedia.org/wiki/ISO_860) formatted string.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}