POST push notifications/devices/:id/publish
(Difference between revisions)
(moved POST push notifications/devices/:id/publish to POST push notifications/devices/:id/publish PT-BR) |
|||
Line 1: | Line 1: | ||
− | + | == Description == | |
+ | |||
+ | Sends a push notification to a device. | ||
+ | |||
+ | == Resource URL == | ||
+ | |||
+ | POST https://api.socialidnow.com/v1/marketing/push_notifications/devices/:id/publish | ||
+ | |||
+ | == Parameters == | ||
+ | |||
+ | === URL Parameters === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | id | ||
+ | | width="200px" | required | ||
+ | | device identifier. | ||
+ | |} | ||
+ | |||
+ | === JSON Parameters === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | data | ||
+ | | width="200px" | required | ||
+ | | a hash in the format field:value, with the necessary fields to create the notification: | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | message | ||
+ | | width="200px" | required | ||
+ | | notification message. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | title | ||
+ | | width="200px" | optional | ||
+ | | [Android] notification title. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | small_icon | ||
+ | | width="200px" | optional | ||
+ | | [Android] notification icon name. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | vibrate | ||
+ | | width="200px" | optional | ||
+ | | [Android] whether to vibrate or not when the notification is received. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | vibrate_duration | ||
+ | | width="200px" | optional | ||
+ | | [Android] vibration duration. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | auto_cancel | ||
+ | | width="200px" | optional | ||
+ | | [Android] whether the notifcation should or not be removed from the notification area when it is opened. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | big_style | ||
+ | | width="200px" | optional | ||
+ | | [Android] whether the notification should or not use BigStyle. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | activity_class | ||
+ | | width="200px" | optional | ||
+ | | [Android] class name to be invoked when the notification is opened. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | badge | ||
+ | | width="200px" | optional | ||
+ | | [iOS] numeric value of the notification badge. | ||
+ | |- | ||
+ | ! align="left" width="180px" style="padding-left: 20px" | sound | ||
+ | | width="200px" | optional | ||
+ | | [iOS] file name of the sound to be played when the notification is received. | ||
+ | |} | ||
+ | |||
+ | == Authentication == | ||
+ | |||
+ | This API requires Social Login App authentication. See [[Authentication]]. | ||
+ | |||
+ | == Response == | ||
+ | |||
+ | === Response Status === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | ok (200) | ||
+ | | The notification was processed successfully. | ||
+ | |- | ||
+ | ! align="left" width="200px" | bad_request (400) | ||
+ | | The parameter "data" wasn't informed or is not a hash. | ||
+ | |- | ||
+ | ! align="left" width="200px" | unauthorized (401) | ||
+ | | The authentication is wrong. See [[Authentication]]. | ||
+ | |- | ||
+ | ! align="left" width="200px" | forbidden (403) | ||
+ | | The device does not belong to the Social Login App. | ||
+ | |- | ||
+ | ! align="left" width="200px" | unprocessable_entity (422) | ||
+ | | Validation error in the field "data". | ||
+ | |- | ||
+ | ! align="left" width="200px" | internal_server_error (500) | ||
+ | | An unknown error happened. | ||
+ | |} | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | === Request === | ||
+ | |||
+ | Creates a Push Notification for the device "4e5274835193bd40844a2102e0a33b61b09a144a6e0ae4413cfd17e30be6dc4d". | ||
+ | |||
+ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/push_notifications/devices/4e5274835193bd40844a2102e0a33b61b09a144a6e0ae4413cfd17e30be6dc4d/publish' \ | ||
+ | -d '{"data":{"message":"hello world", "vibrate":false, "badge":5}}' \ | ||
+ | -H 'Content-type:application/json' \ | ||
+ | --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | ||
+ | |||
+ | === Response === | ||
+ | |||
+ | ==== Response Headers ==== | ||
+ | |||
+ | HTTP/1.1 200 Ok | ||
+ | Status: 200 |
Revision as of 20:26, 3 November 2014
Contents |
Description
Sends a push notification to a device.
Resource URL
POST https://api.socialidnow.com/v1/marketing/push_notifications/devices/:id/publish
Parameters
URL Parameters
id | required | device identifier. |
---|
JSON Parameters
data | required | a hash in the format field:value, with the necessary fields to create the notification: |
---|---|---|
message | required | notification message. |
title | optional | [Android] notification title. |
small_icon | optional | [Android] notification icon name. |
vibrate | optional | [Android] whether to vibrate or not when the notification is received. |
vibrate_duration | optional | [Android] vibration duration. |
auto_cancel | optional | [Android] whether the notifcation should or not be removed from the notification area when it is opened. |
big_style | optional | [Android] whether the notification should or not use BigStyle. |
activity_class | optional | [Android] class name to be invoked when the notification is opened. |
badge | optional | [iOS] numeric value of the notification badge. |
sound | optional | [iOS] file name of the sound to be played when the notification is received. |
Authentication
This API requires Social Login App authentication. See Authentication.
Response
Response Status
ok (200) | The notification was processed successfully. |
---|---|
bad_request (400) | The parameter "data" wasn't informed or is not a hash. |
unauthorized (401) | The authentication is wrong. See Authentication. |
forbidden (403) | The device does not belong to the Social Login App. |
unprocessable_entity (422) | Validation error in the field "data". |
internal_server_error (500) | An unknown error happened. |
Examples
Request
Creates a Push Notification for the device "4e5274835193bd40844a2102e0a33b61b09a144a6e0ae4413cfd17e30be6dc4d".
curl -iX POST 'https://api.socialidnow.com/v1/marketing/push_notifications/devices/4e5274835193bd40844a2102e0a33b61b09a144a6e0ae4413cfd17e30be6dc4d/publish' \ -d '{"data":{"message":"hello world", "vibrate":false, "badge":5}}' \ -H 'Content-type:application/json' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 200 Ok Status: 200