{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/users/user_id/events","auth":"required","method":"post","params":[{"name":"user_id","type":"string","default":"","desc":"A Sailthru Mobile user ID","required":false,"in":"path","ref":"","_id":"57f2c04f89faf32b004f8329"},{"name":"events","type":"object","default":"","desc":"JSON object containing array of events","required":false,"in":"body","ref":"","_id":"57f2c04f89faf32b004f8328"}],"results":{"codes":[{"code":"// your events have been successfully registered\n{}","name":"","status":202,"language":"json"},{"status":400,"language":"json","code":"//your event data is not in the correct format\n//common issues include: no event name, invalid event object, no events\n{}","name":""},{"status":401,"language":"text","code":"// This error is given when your API client credentials are not correct. \n{\n  \"error\":\"unauthorized\"\n}"}]},"settings":"","examples":{"codes":[{"name":"Basic Event","code":"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","language":"curl"},{"name":"Multiple Events","language":"curl","code":"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"},{"name":"Event without a specific date","language":"curl","code":"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"}]},"apiSetting":null},"next":{"description":"","pages":[]},"title":"Users / Events","type":"endpoint","slug":"users-events","excerpt":"","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.","updates":[],"order":10,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5e6156bf5e4a51006dcd8164","createdAt":"2016-10-03T00:38:53.638Z","version":{"version":"1.5","version_clean":"1.5.0","codename":"ST Rebrand","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5e6156bf5e4a51006dcd8120","5e6156bf5e4a51006dcd8121","5e6156bf5e4a51006dcd8122","5e6156bf5e4a51006dcd8123","5e6156bf5e4a51006dcd8124","561c61b4ad272c0d00a892df","586c014c0abf1d0f000d04d4","58991d2ad207df0f0002186b","5e6156bf5e4a51006dcd8125","5e6156bf5e4a51006dcd8126","5af0fe494ca2730003cbc98a","5af0fe55ec80af0003804ca2","5e69868cbd5dcb006b35867b","5e6986ca2c6652006791b6e8"],"_id":"5e6156bf5e4a51006dcd818c","project":"55e67aaa9cc7c62b00c4a1ea","__v":2,"forked_from":"5b720760c44b7600034b7a08","createdAt":"2015-09-02T04:27:23.612Z","releaseDate":"2015-09-02T04:27:23.612Z"},"category":{"sync":{"isSync":false,"url":""},"pages":["5e6156bf5e4a51006dcd8138","55ed079b0d968e2100de8339","5e6156bf5e4a51006dcd8139","55ed0bb078319821005005cf","5e6156bf5e4a51006dcd813a","5e6156bf5e4a51006dcd813b","5e6156bf5e4a51006dcd813c","5e6156bf5e4a51006dcd813d","5e6156bf5e4a51006dcd813e","5e6156bf5e4a51006dcd813f","5e6156bf5e4a51006dcd8140","5e6156bf5e4a51006dcd8141","5e6156bf5e4a51006dcd8142","5e6156bf5e4a51006dcd8143","5e6156bf5e4a51006dcd8144","5e6156bf5e4a51006dcd8145","5b720760c44b7600034b79ce","5e6156bf5e4a51006dcd814d","5e6156bf5e4a51006dcd814e","5e6156bf5e4a51006dcd8156"],"title":"REST API","slug":"rest-api","order":5,"from_sync":false,"reference":true,"_id":"5e6156bf5e4a51006dcd8122","__v":20,"createdAt":"2015-09-02T04:30:21.948Z","project":"55e67aaa9cc7c62b00c4a1ea","version":"5e6156bf5e4a51006dcd818c"},"__v":12,"parentDoc":null,"user":"57e9c9dc80c0490e00480948","githubsync":"","project":"55e67aaa9cc7c62b00c4a1ea"}

postUsers / Events


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

user_id:
string
A Sailthru Mobile 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 }}