POST push notifications/devices
(Difference between revisions)
Line 1: | Line 1: | ||
− | + | {{DISPLAYTITLE:POST push notifications/devices}} | |
+ | == Description == | ||
+ | |||
+ | Adds a new device the Social Login App devices list. | ||
+ | |||
+ | == Resource URL == | ||
+ | |||
+ | POST https://api.socialidnow.com/v1/marketing/push_notifications/devices | ||
+ | |||
+ | == Parameters == | ||
+ | |||
+ | === JSON Parameters === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | device | ||
+ | | width="200px" | required | ||
+ | | a hash in the format field:value, with the necessary fields to create the device: | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | token | ||
+ | | width="200px" | required | ||
+ | | token to identify the device. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | platform | ||
+ | | width="200px" | required | ||
+ | | device platform: "ios" or "android". | ||
+ | |} | ||
+ | |||
+ | == Authentication == | ||
+ | |||
+ | This API requires Social Login App authentication. See [[Authentication]]. | ||
+ | |||
+ | == Response == | ||
+ | |||
+ | === Response Status === | ||
+ | {| | ||
+ | ! align="left" width="200px" | created (201) | ||
+ | | The device was created successfully. | ||
+ | |- | ||
+ | ! align="left" width="200px" | ok (200) | ||
+ | | The device had already been created. | ||
+ | |- | ||
+ | ! align="left" width="200px" | bad_request (400) | ||
+ | | The parameter "device" wasn't informed or is not a hash. | ||
+ | |- | ||
+ | ! align="left" width="200px" | unauthorized (401) | ||
+ | | The authentication is wrong. See [[Authentication]]. | ||
+ | |- | ||
+ | ! align="left" width="200px" | unprocessable_entity (422) | ||
+ | | Validation error in the field "device". | ||
+ | |- | ||
+ | ! align="left" width="200px" | not_found (404) | ||
+ | | No mobile application was found for the given Social Login App. | ||
+ | |- | ||
+ | ! align="left" width="200px" | internal_server_error (500) | ||
+ | | An unknown error happened. | ||
+ | |} | ||
+ | |||
+ | === Response Body === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | id | ||
+ | | device identifier. | ||
+ | |} | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | === Request === | ||
+ | |||
+ | Creates a new Android device for the Social Login App "138". | ||
+ | |||
+ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/push_notifications/devices' \ | ||
+ | -d '{"device":{"platform":"android", "token":"US4Xy2tJyRg0Qe-DiuWXa1mLJAhYjSQ-fhLlmqrXq6iywBAhnqGb9-xlOneFF6lgyFbrs6wuJAdjpACt0D6374RFBpng7m8HuUgHWYZxfvlvBJL7f5nu0CSJHc5oYtOJI-raHizuWduPuvf05pfuAf6ETyqVfuZyyCOlUGhoJiS2TqH98c8NDym"}}' \ | ||
+ | -H 'Content-type:application/json' \ | ||
+ | --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | ||
+ | |||
+ | === Response === | ||
+ | |||
+ | ==== Response Headers ==== | ||
+ | |||
+ | HTTP/1.1 201 Created | ||
+ | Status: 201 | ||
+ | |||
+ | ==== Response Body ==== | ||
+ | |||
+ | { | ||
+ | "id":"4e5274835193bd40844a2102e0a33b61b09a144a6e0ae4413cfd17e30be6dc4d" | ||
+ | } |
Revision as of 20:13, 3 November 2014
Contents |
Description
Adds a new device the Social Login App devices list.
Resource URL
POST https://api.socialidnow.com/v1/marketing/push_notifications/devices
Parameters
JSON Parameters
device | required | a hash in the format field:value, with the necessary fields to create the device: |
---|---|---|
token | required | token to identify the device. |
platform | required | device platform: "ios" or "android". |
Authentication
This API requires Social Login App authentication. See Authentication.
Response
Response Status
created (201) | The device was created successfully. |
---|---|
ok (200) | The device had already been created. |
bad_request (400) | The parameter "device" wasn't informed or is not a hash. |
unauthorized (401) | The authentication is wrong. See Authentication. |
unprocessable_entity (422) | Validation error in the field "device". |
not_found (404) | No mobile application was found for the given Social Login App. |
internal_server_error (500) | An unknown error happened. |
Response Body
id | device identifier. |
---|
Examples
Request
Creates a new Android device for the Social Login App "138".
curl -iX POST 'https://api.socialidnow.com/v1/marketing/push_notifications/devices' \ -d '{"device":{"platform":"android", "token":"US4Xy2tJyRg0Qe-DiuWXa1mLJAhYjSQ-fhLlmqrXq6iywBAhnqGb9-xlOneFF6lgyFbrs6wuJAdjpACt0D6374RFBpng7m8HuUgHWYZxfvlvBJL7f5nu0CSJHc5oYtOJI-raHizuWduPuvf05pfuAf6ETyqVfuZyyCOlUGhoJiS2TqH98c8NDym"}}' \ -H 'Content-type:application/json' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 201 Created Status: 201
Response Body
{ "id":"4e5274835193bd40844a2102e0a33b61b09a144a6e0ae4413cfd17e30be6dc4d" }