Child pages
  • PushNotification

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Apstratasummary

The PushNotification API allows to send notification alerts to all devices subscribed in a particular channel, or to a set of devices that is defined when calling the API (this is called "ad-hoc" push). When sending a notification through a channel, the caller needs to fill the following parameters: "channelId", "notification" and "fireAndForget" (optional). If the caller rather wishes to send a notification to an arbitrary set of device tokens, he should fill the following parameters: "notification", "adhoc.tokens", "adhoc.platform", "adhoc.applicationID". 

The PushNotification API can be called over HTTP (i.e. does not need to be called over HTTPS as it is the case for the other push notification APIs). Notifications can be sent synchronously or asynchronously. In case the targeted platform is "iOS", the notifications are pushed to the APNS server which then sends the notification to all the specific devices. In case the targeted platform is "Android", the notifications are sent to GCM FCM server which then sends the notification to all the specific devices.

Expand
titleWhat are Push Notifications?

Excerpt Include
Push Notifications
Push Notifications
nopaneltrue

...

(Refer to Common Request Parameters)

Name

Description

Required

Default

Possible Values

apsdb.store

The name of the store in which the channel is created

No

DefaultStore

 


channelIdA unique identifier for the channelYes
  


notification

The payload embracing the notification message to be sent. For iOS payload details, please refer to

http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1

For Android, the payload needs to be sent in the following format {"key1":"value1","key2":"value2", ...}

Yes

 

 



fireAndForgetA boolean indicating whether to send the notification in synchronous or asynchronous mode. If set to true, then the mode is asynchronousNotruetrue
false 
adhoc.tokensA array of device tokens. Fill this parameter when you do not want to push a notification through a channel, but rather to an arbitrary set of devices.No
  


adhoc.platformThe targeted platform, i.e. the platform of the devices (iOS or Android).  Fill this parameter when you do not want to push a notification through a channel, but rather to an arbitrary set of devices.No
 

"Android", "iOS"
adhoc.applicationIDThe identifier of the mobile application (as created in Apstrata using the "AddCertificate" API). Fill this parameter when you do not want to push a notification through a channel, but rather to an arbitrary set of devices.No
  


adhoc.lifeTimeThe time in seconds before a notification expires. Can be a negative number. Please refer to the documentation of the respective services (APNS and Google) for more on this value. Fill this parameter when you do not want to push a notification through a channel, but rather to an arbitrary set of devices.No
 

5

Specific Response Elements

...

If the notification was pushed to iOS platforms, the specificAttributes array will contain "command : command_value", "status :  status_value" and "identifier : identifier_valuei" as returned by APNS (for more on what is returned by APNS, please refer to http://developer.apple.com/library/ios/#DOCUMENTATION/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html)

If the notification was pushed to Android platforms, the specificAttributes array will contain "usedToken : the_auth_token_that_was_used_to_push_the_notification", "updatedToken : empty_or_a_new_auth_token_sent_by_GCMFCM". Concerning this latter attribute, note that GCM FCM periodically refreshes the authentication token of a mobile application and this is transparently tackled by the Apstrata Push API. Therefore, when "updatedToken" is not empty, this indicates that the push to the concerned device was successful but that a new auth token was obtained from GCMFCM. This new token will be used for pushing further notifications.

...

(Refer to Common Logical Error Codes)

Error

Description

Status Code

INVALID_STORE_NAME

Store name is invalid.

400

STORE_NOT_FOUND

The store was not found

404

PARAMETER_REQUIREDOne of the required parameters is missing400
INVALID_REQUESTThe request is made over HTTP and not HTTPS400
PERMISSION_DENIEDThe request is made by a regular user and not by the account owner403
DOCUMENT_NOT_FOUNDThe channel does not exist400
INVALID_NOTIFICATIONInvalid payload400

 


Examples

Sample Request

Code Block
Request URL: http://sandbox.apstrata.com/apsdb/rest/[authenticationkey]/PushNotification?apsws.time=[timestamp]&apsws.authSig=[signature] 


...