Message-ID: <597512484.459.1402601237195.JavaMail.confluence@centos6.5-prod> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_458_221594226.1402601237183" ------=_Part_458_221594226.1402601237183 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html API Reference

API Reference

 

Introduction

General

Understanding the difference between DeviceId and CustomId

By using the remote API, we give you the option the add your own c= ustom Id to each device, which can be used instead or in addition to the De= viceId which is supplied by the SDK. As a rule, CustomId receives higher pr= iority than DeviceId in your API requests.

Request Object

Response Object

The response body is a JSON formatted string, which represents the follo= wing object:

Name Type Description
Code Int mandatory one of our Status codes, listed fo= r each request
Message String mandatory message explaining the code
Data Object optional used in some methods to provide mo= re data

If the response is not specifically mentioned it does not contain the Da= ta field.

Example:

 

{
   "Code" : 100,
   "Message" : "OK" ,
   "Data"=20 : { "SomeKey"=20 : "SomeValue"=20 }
}

 

Enums

&= nbsp;DeviceType

The device's platform type

Name Value
Android 1
iOS 2

Notification Interval

The schedule notification interval

Name Value
Daily 1
Weekly 2
Monthly 3

 Notification status

The notification current status

Name Value Description
Not Sent 1 Notification not sent yet.
Sending 2 Notification is in sending process=
Received 3 Notification received by the appli= cation user
Opened 4 Application's user clicked and ope= ned the notification
Failed 5 Failed to send notification
Push Token Expired 6 Application's user haven't logged = in to application for a long time and his push token is no longer valid
Disabled 7 Notification has canceled due to u= ser's request
Subscription Changed 8 Application's user's push token ha= s been changed, notification is sent. (Android Only)
Wrong Service Credentials 9 For android platform -> GCM_API= _Key might be invalid , iOS platform -> Corrupted P12 file or bad certif= icate

Objects

 = ;Device

A device, which will be the target of the notification

Name Type Description
PushToken String mandatory The token received from Google or = Apple for the device
DeviceId String mandatory A unique string within this app to= identify this device. Could be the IMEI in Android for example or UDID on = iOS
DeviceType DeviceType mandatory the device platform type

PlatformFeatures

Platform specific features for a notification. When adding them to a req= uest the SDK will act according to the requested features.

Name Type Description
AndroidTitle  String

optiional (default will be the = application name

on the device)

The token received from Google or = Apple for the device
AndroidSound String

optiional (default will be be t= he default

system notification sound)

A unique string within this app to= identify this device. Could be the IMEI in Android for example or UDID on = iOS
iOSBadge  Int optiional (default is 1) the device platform type
iOSSound String optiional (default is "defaul= t") name of the sound file to play whe= n receiving a notification (empty string will cause the notification to be = silent)

 

SchedulingFeatures

Scheduling features allows you to send your notification on a specific d= ate or/and with a number of occurrences. This is an optional feature that c= an be added to the base of the notification request.

=20
=20

Important

=20 Icon=20
=20

if EndDate and Occurrences aren't supp= lied, the EndDate will automatically will be 'Neve= r' and the sending will never be stopped.

=20
=20
=20
Name Type Description
Interval NotificationInterval

Interval that determines the de= lay between each sending

EndDate

ISO formatted String, in UTC timezone, format=

is yyyy-MM-ddTHH:mm:ssZ

optional, the end date of the s= chedule notification.

Occurrences Int optional, times the notification w= ill be sent
StartDate

ISO formatted String, in UTC ti= mezone, format

is yyyy-MM-ddTHH:mm:ssZ

<= /td>
optional (default is now), the tim= e for the first notification
ConsiderDeviceTimeZone Boolean

optional (default is false), se= nding the notification on the provided time according to the device's time = zone.

Methods

1. RegisterDevice

Register a specific device in the system

Request

Method URL
POST RemoteAPI/RegisterDevice

Arguments

Name Type Description
SecretToken  String mandatory The token received from PushApps for using the Remote API
PushToken  String mandatory The token received from Google or Apple by the device
DeviceId  String mandatory (not needed only ifCustomId was u= sed) A unique string within this app to identify this device. Could be the IMEI= in Android for example or UDID on iOS
CustomId String mandatory (not needed only if= DeviceId was used) Custom id that represents the device.
DeviceType  DeviceType mandatory  
OSVersion  String optional This device operating system version
SDKVersion  String optional Pushapps sdk version
DeviceDescription  String optional The hardware of the device, i.e "iPhone 5"
AppVersion  String optional This app current version
TimeZone Int optional The device's offset from UTC in mi= nutes. For example, UTC +01:00 will be 60

 

Request example

 

{
"SecretToken" : "YOUR SECRET TOKEN" ,
"PushToken" : "some push token" ,
"DeviceId" : "79848" ,
"CustomId" : "nbf674m79gd83db" ,
"DeviceType" : 2,
"OSVersion" : "7.1" ,
"DeviceDescription" : "iPhone 5s" ,
"SDKVersion" : "1" ,
"AppVersion"=20 : "3.1.3"
}

 

Available status codes

Status

Message

100=

OK 

101=

One parame= ter at least is missing or wrong

102=

The input = is not well formatted

200=

You are no= t authorized for this action, please check the credentials again or contact= support

900=

There has = been a service error

2. UnregisterDevice

Unregister a specific device in the system, using the device id or custo= m id supplied when it was registered

Request

Method URL
POST RemoteAPI/UnregisterDevice

Arguments

Name Type Description
SecretToken  String mandatory The token received from PushApps for using the Remote API
DeviceId  String optional (you must use either this or CustomId)<= /td> A unique string within this app to identify this device. Could be the IMEI= in Android for example or UDID on iOS
CustomId String optional (not needed if DeviceId was used) Custom id that represents the device.

Request example

 

{
"SecretToken" : "YOUR SECRET TOKEN" ,
"DeviceId" : "79848"
}

 

Available status codes

Status

Message

100

OK 

101=

One parame= ter at least is missing or wrong

102=

The input = is not well formatted

109=

The reques= ted device does not exist

200=

You are no= t authorized for this action, please check the credentials again or contact= support

900=

There has = been a service error

3. CreateNotification

Creates an immediate notification in the system, for all the devices reg= istered for this app, or by platforms, or for an array of devices, or by an= array of device ids or custom ids.

Request

Method URL
POST RemoteAPI/Cre= ateNotification

Arguments

Name Type Description
SecretToken&n= bsp; String <= /span> mandatory The token received from PushApps for using the Remote API
Message String  mandatory The content of the message
Platforms Array of DeviceType optional The platforms this notification will be sent to. If not set or empty the n= otification will be sent to all platforms
Devices Array of Device

optional

If not supplied or empty, the notification will be sent to all available d= evices according to the selected platforms
DeviceIds Array of Strings

optional

 

If supplied, message will be delivered to supplied deviceIds. =
Canno= t be used along with CustomIds.
CustomIds Array of Strings

optional

If supplied, message will be delivered to supplied CustomIds. =
Canno= t be supplied with DeviceIds.
Link String optional If exists the device will open a browser with the URL specified here
PlatformFeatures PlatformFeatures optional Features per platform. This parameter is optional and also each field insi= de it is optional. 
CustomJsonKey String optional The key in the data object received in the push notification. If you suppl= y a CustomJsonKey you must supply the CustomJson as well
CustomJson String optional The value of the data object received in the push notification. can be eit= her a JSON formatted string or a regular string. if you supplyC= ustomJson and don't supply a CustomJsonKey we will use our default key (D)<= /td>
Id Int optional

Add more devices to a specific notification by the notification id you = receive from us.Use this If you need to send notifications to specific devi= ces that are more than 10,000 devices. you will receive this id in your fir= st request's response. afterwards call the request with more devices as man= y times as you need, always using the same Id.

Scheduling SchedulingFeatures optional Scheduling features allows you to = plan further ahead your notifications by setting the send date to a specifi= c day and adding number of occurrences.

 

Request example

 

{
     "SecretToken" : " YOUR SECRET TOKEN " ,
     "Message" : "hello world" ,
     "Link" : "http://pushapps.mobi" ,
     "Platforms" : [],
     "PlatformFeatures" : {
        <= /code> "AndroidTitle" : "some android Title" ,
        <= /code> "iOSBadge" : 1
     },
     "CustomJsonKey" : "myKey" ,
     "CustomJson" : "{
        <= /code> "someKey" : "someVal"
     }",
     "Devices" : [
        <= /code> {
        &= nbsp;    "PushToken" : "APA91bE1ta3vuTW63-pDxpb8YOLWdw846XD5EprodjC= AOHg3dx-GDTc-UvrarmtoYZpgqMAVIbLv-CPIuemg2P42edeKqb4rIq-HhViU2kGeW5qWEMitcE= 83qn-rIy4Lnzu7GclKdc5nhJLHqTwy8m0fkBMfF1zGpc1ME_gisIS_t25muUJDCPY" ,
        &= nbsp;    "DeviceType" : 1
        <= /code> },
        <= /code> {
        &= nbsp;    "PushToken" : "c3b24fdc7b7a6a449e2f7c4b311c62cd0189378a477= 4519ae3c1c0f5dde532a4" ,
        &= nbsp;    "DeviceType" : 2
        <= /code> }
     ],
     "DeviceIds" : [
        <= /code> "359372043909118"
     ],
     "Scheduling" : {
        <= /code> "StartDate" : "2014-05-12T13:00:00Z"= ,
        <= /code> "EndDate" : "2014-06-12T13:00:00Z"= ;,
        <= /code> "Interval" : 1
     }

 

 

}

 

Response example

 

{
   "Code" : 100,
   "Message" : "OK" ,
   "Data" : {
     "Id" : 3760
   }
}

 

Available status codes

Status

Message

100=

OK 

101=

One parame= ter at least is missing or wrong

102=

The input = is not well formatted

103=

The .P12 f= ile needed to complete the operation wasn't found. Please check for active = .P12 file for your gateway.

104=

Cannot sen= t notification to application without users

105=

iOS payloa= d is too large

106=

Applicatio= n does not have any components

110=

Android de= vice is not yet configured for this app

113=

Sending no= tification with custom parameters is limited to 10,000 users. Use provided = Id to insert maximum of 10,000 users per request.

116=

You provid= ed more than 1 option to send notification. Please choose only 1.

118 Cannot send scheduled notification= to specific users.
119 Cannot add more devices to schedul= ed notification.
121 Could not find devices by provided= data.
122 One or more of the platforms provi= ded is unknown.

200=

You are no= t authorized for this action, please check the credentials again or contact= support

900=

There has = been a service error

4. GetNotification= sForDevice

Gets all notification that were sent to a specific device by either Devi= ceId or by CustomId.

Request

Method URL
POST RemoteAPI/Get= NotificationsForDevice

Arguments

Name

Type

Description

SecretToke= n 

string&nbs= p;

mandatory

The token = received from PushApps for using the Remote API

Amount

Int=

optional

Amount of = the notifications returned, if not supplied returns max amount of notificat= ions which is equal to 1000.

Index

Int=

optional

If su= pplied, returns a response from the given index. If not supplied, returns f= rom the first index. Lowest index value is 1.

DeviceId

string&nbs= p;

mandatory

Device Id = that the was set to a specific device. You can supply it in addition to Cus= tomId or without it.

CustomId

string

mandatory

Custom Id = that the was set to a specific device. You can supply it in addition to Dev= iceId or without it.

Request example

 

{
     "SecretToken" : " YOUR SECRET TOKEN " ,
     "Amount" : 3,
     "Index" : 1,
     "DeviceId" : "SOME DEVICE ID" ,
     "CustomId" : "SOME DEVICE CUSTOM ID"
}

 

Response example

 

{
     "Code" : 100,
     "Message" : "OK" ,
     "Data" : {
        <= /code> "Index" : 3,
        <= /code> "HasMore" : true ,
        <= /code> "Notifications" : [
        &= nbsp;    {
        &= nbsp;        "Date" : "2013-10-15T13:29:40Z" ,
        &= nbsp;        "Message" : "Hello World!" ,
        &= nbsp;        "Status" : 4
        &= nbsp;    },
        &= nbsp;    {
        &= nbsp;        "Date" : "2013-10-16T16:38:29Z" ,
        &= nbsp;        "Message" : "This is my message" ,
        &= nbsp;        "Status" : 3
        &= nbsp;    },
        &= nbsp;    {
        &= nbsp;        "Date" : "2013-10-17T08:12:40Z" ,
        &= nbsp;        "Message" : "Hello World!" ,
        &= nbsp;        "Status" : 3
        &= nbsp;    }
        <= /code> ]
     }
}

 

HasMore =3D true  indicates that there are more re= sults for this request that were not able to be sent due to the Amount argu= ment value. You should call this request again with the Index<= /strong> received to get more results starting from that index.

Available status codes

Status

Message

100=

OK 

101=

One parame= ter at least is missing or wrong

102=

The input = is not well formatted

111=

Device's C= ustomId is too large, Limited to 100 chars.

200=

You are no= t authorized for this action, please check the credentials again or contact= support

900=

There has = been a service error

5. SetDeviceWithCustom= Id

Sets a custom id for a specific device by its DeviceId. This is used for= future analysis and fetching data
(i.e : GetNotificationsForDevice).

Request

Method URL
POST RemoteAPI/Set= DeviceWithCustomId

Arguments

Name

Type

Description

SecretToke= n 

string&nbs= p;

mandatory

The token = received from PushApps for using the Remote API

DeviceId

string&nbs= p;

mandatory

Device Id = that the was set to a specific device.

CustomId

string

mandatory

Custom Id = that you want to set to the specific device

Request example

 

{
     "SecretToken" : " YOUR SECRET TOKEN " ,
     "DeviceId" : "SOME DEVICE ID" ,
     "CustomId" : "SOME DEVICE CUSTOM ID"
}

 

Available status codes

Status

Message

100=

OK 

101=

One parame= ter at least is missing or wrong

102=

The input = is not well formatted

109=

The reques= ted device does not exist

111=

Device's C= ustomId is too large, Limited to 100 chars.

200=

You are no= t authorized for this action, please check the credentials again or contact= support

900=

There has = been a service error

6. GetDevices

Gets all app users for application either by their DeviceType or all of th= em.

Request

Method URL
POST RemoteAPI/Get= Devices

Arguments

Name

Type

Description

SecretToke= n 

string&nbs= p;

mandatory

The token = received from PushApps for using the Remote API

Amount int optional Amount of the= users returned, if not sent returns max amount of users which is equal to = 1000.
Index Int optional If supplied, returns a response from the given index. If not supplied, ret= urns from the first index. Lowest Index value is 1.
Platforms Array ofDeviceType optional If supplied, return users matching the given platforms. If not supplied re= turns users regardless of their platforms

Request example

 

{
     "SecretToken" : " YOUR SECRET TOKEN " ,
     "Amount" : 3,
     "Index" : 1,
     "DeviceTypes" : [
        <= /code> 2
     ]
}

 

Response example

 

{
     "Code" : 100,
     "Message" : "OK" ,
     "Data" : {
        <= /code> "Index" : 2,
        <= /code> "Devices" : [
        &= nbsp;    {
        &= nbsp;        "PushToken" : "cd0189378a4774519ae3c1c1j9dde532a4" ,
        &= nbsp;        "DeviceId" : "2C18D56E-4E18-42C5-8771-2g27E464A358"<= /code> ,
        &= nbsp;        "CustomId" : "511" ,
        &= nbsp;        "DeviceType" : 2,
        &= nbsp;        "TimeZone" : 0
        &= nbsp;    },
        &= nbsp;    {
        &= nbsp;        "PushToken" : "b8b37b6ee2039e36774d2aa2651674f430ac571a408= 5d" ,
        &= nbsp;        "DeviceId" : "92B06DB6-A3DE-4C99-8D02-37C9FA59C825"<= /code> ,
        &= nbsp;        "CustomId" : "1404" ,
        &= nbsp;        "DeviceType" : 2,
        &= nbsp;        "TimeZone" : 0
        &= nbsp;    }
        <= /code> ]
     }
}

 

Available status codes

Status

Message

100=

OK 

101=

One parame= ter at least is missing or wrong

102=

The input = is not well formatted

200=

You are no= t authorized for this action, please check the credentials again or contact= support

900=

There has = been a service error

7. ReportUserEvent

Saving an event of a specific user. If the event is configured with noti= fication, notifications will be sending according to the specified delay.

Request

Method URL
POST RemoteAPI/Rep= ortUserEvent

Arguments

Name

Type

Description

SecretToke= n 

string&nbs= p;

mandatory

The token = received from PushApps for using the Remote API

EventIdentifier string <= /span> mandatory The identifie= r of the event. If event isn't already been configured in the Admin Console= , it will be created after making this request.
DeviceId string  mandatory Device Id that the was set to a specific device. Mandatory if CustomId was= not supplied
CustomId string  mandatory Custom Id that the was set to a specific device. Mandatory if DeviceId was= not supplied

Request example

 

{
     "SecretToken" : " YOUR SECRET TOKEN " ,
     "EventIdentifier" : "In_App_Purchase_1" ,
     "DeviceId" : "12789617286112"
}

 

Available status codes

Status

Message

100=

OK 

101=

One parame= ter at least is missing or wrong

102=

The input = is not well formatted

200=

You are no= t authorized for this action, please check the credentials again or contact= support

900=

There has = been a service error

8. CheckIOSPayload

Check your notification payload before sending it. iOS payload is a limi= t determined by Apple and is now set to 255 Bytes

Request

Method URL
POST RemoteAPI/CheckIOSPayload

Arguments

Name

Type

Description

SecretToke= n 

string&nbs= p;

mandatory

The token = received from PushApps for using the Remote API

Message

string <= /span> mandatory The message itself
Link= string  optional The Url that will be opened via us= er=E2=80=99s browser when clicking on the notification.
Cust= omJsonKey string  optional The key in the data object receive= d in the push notification. If you supply a CustomJsonKey you must supply t= he CustomJson as well
Cust= omJson string or JSON formatted string optional The value of the data object received in the push notification. can be eit= her a JSON formatted string or a regular string. if you supplyC= ustomJson and don't supply a CustomJsonKey we will use our default key (D)<= /td>

Request example

 

{
     "SecretToken" : " YOUR SECRET TOKEN " ,
     "Message" : "Hello World" ,
     "Link" : "http://www.google.com" ,
     "CustomJson" : "<your json>"
}

 

Available status codes

Status

Message

100=

OK 

101=

One parame= ter at least is missing or wrong

102=

The input = is not well formatted

105 Ios payload is too large

200=

You are no= t authorized for this action, please check the credentials again or contact= support

900=

There has = been a service error


Callbacks

You can provide callback URL through the Admin Console to listen for events in the system.

For more information regarding callbacks please visit Using callbacks

 

What's next?

  • After reading through the API reference, you can start diving into some= coding.

 

 

------=_Part_458_221594226.1402601237183--