POST push notifications/devices/:id/publish
From Social ID Developers
(Difference between revisions)
Line 84: | Line 84: | ||
|- | |- | ||
! align="left" width="200px" | forbidden (403) | ! align="left" width="200px" | forbidden (403) | ||
− | | The device does not belong to the | + | | The device does not belong to the Login App. |
|- | |- | ||
! align="left" width="200px" | unprocessable_entity (422) | ! align="left" width="200px" | unprocessable_entity (422) |
Latest revision as of 16:58, 30 December 2021
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 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 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