Namespace: OpenEdge.Mobile
Class
ApperyPushNotificationService
Parent classes:
Inherits: OpenEdge.Mobile.PushNotificationService

Copyright (c) 2015 by Progress Software Corporation. All rights reserved.
File:ApperyPushNotificationService
Purpose:Sends push notifications to a device or devices.
Author(s):pjudge
Created:Mon Feb 10 16:41:36 EST 2014
Notes:* Doc at http://docs.mobile.rollbase.com/documentation/backendservices/push/
requests, see the JSON generated when using the
"Devices filtered using query builder" functionality in the
Push Notifications / Send push notification page at
https://mobile.rollbase.com/push/.
to the according URL. filter is the optional parameter, when
its empty Push Notification is sent to all devices.
schedule is the optional parameter, when its not empty
Push Notification can be scheduled.
curl -X POST \
-H "X-Appery-Push-API-Key:<pushAPIKey>" \
-H "Content-Type: application/json" \
-d '{"payload":{"message" : <message>, "badge" : <badge>}[, "filter" : {"deviceID" : <deviceID criteria>,"<param1>" : <criteria>, ...}][, "schedule": {"scheduledTime": <scheduled_time>, "useTimeZone": <use_time_zone>}]}' \
https://api.appery.io/rest/push/msg
where:
<pushAPIKey> is a unique key, issued by server, which allows sending Push Notifications;
<message> is the message text (mandatory);
<badge> is the number shown with app icon in iOS (optional, if empty - badge is not changed on device);
<deviceID criteria> is deviceID criteria for searching device;
<param1> is a custom field of _devices table;
<criteria> is param1 criteria for searching device;
<scheduled_time> is the date when Push Notification should be sent (it is always truncated to minute);
<use_time_zone> is a boolean parameter indicating whether Push Notification should be sent in device time zone.
If Push Notification is scheduled, server returns HTTP 200 and list of saved Push Notifications, else server returns HTTP 204 NO CONTENT status even if no messages were sent or delivered.
Error HTTP Code Description
Push API Key not found 404 PNMM004 Master Key: <pushAPIKey> not found
Empty message 400 PNMM017 Message cant be empty
Badge negative 400 PNMM062 Badge cannot be negative
No iOS certificate 400 PNMM082 iOS Push certificate is not set
No android API key 400 PNMM084 Android API key is not set
No iOS certificate password 400 PNMM085 iOS Push certificate password is not set
Purpose: Constructor.




Method Summary
Options Name Purpose
ProcessResponse (IHttpResponse) /** Processes a response from the Notification service. Creates and throws a NotificationServiceError if necessary. @param HttpResponse The result of the REST request. @throws NotificationServiceError Throws an error if the return code is not 200 or 204 */
Progress.Json.ObjectModel.JsonConstruct SendNotification (JsonObject) /** Sends a notification for a given payload. The payload may be built by one of the methods in this class, or created by the PushNotificationMessageBuilder class (which is also used internally). This method performs the actual request to the Notification Service. @param JsonObject The notification payload. */

Constructor Summary
Options Name Purpose
ApperyPushNotificationService (character) /** Constructor. @param character The (mandatory) API key to enable notifications */
ApperyPushNotificationService (URI, character) /** Constructor. @param URI A URI representing the notification server @param character The (mandatory) API key to enable notifications */


Method Detail
Top

ProcessResponse (IHttpResponse)

Purpose: Processes a response from the Notification service. Creates and throws
a NotificationServiceError if necessary.
@throws NotificationServiceError Throws an error if the return code is
not 200 or 204
Parameters:
poResponse OpenEdge.Net.HTTP.IHttpResponse
Top

Progress.Json.ObjectModel.JsonConstruct SendNotification (JsonObject)

Purpose: Sends a notification for a given payload. The payload may be built by one
of the methods in this class, or created by the PushNotificationMessageBuilder
class (which is also used internally).
This method performs the actual request to the Notification Service.
Parameters:
poPayload Progress.Json.ObjectModel.JsonObject
Returns Progress.Json.ObjectModel.JsonConstruct


Constructor Detail
Top

ApperyPushNotificationService (character)

Purpose: Constructor.
Parameters:
pcApiKey CHARACTER
Top

ApperyPushNotificationService (URI, character)

Purpose: Constructor.
Parameters:
poURI OpenEdge.Net.URI
pcApiKey CHARACTER


Copyright © 2022 Progress Software Corporation. All rights Reserved.

Progress® OpenEdge® Release 11.7.15