Documentation for Intellect 4.9.8. Documentation for other versions of Intellect is available too.

Skip to end of metadata
Go to start of metadata
In the section:
 

APNS(iOS), C2DN (Android), etc. notification systems are in use.

deviceid – device token (APNs), registration id (C2DN), etc.;

username – login. The field can be blank.

Subscribing

When the app connects to service, the APNS messages subscription is performed. So when the app is closed, device will receive events notifications.

POST 

http://example.com:[port][/somecontext]/secure/subscription/

Reply with “201 Created” code means that subscribing is performed successfully.

Code 400 means that specified parameters are invalid (deviceId is not to be empty, it's length should be from 5 to 150 symbols and contain only digits and letter of English alphabet).

The POST body should contain information about created subscribing. Only JSON format is received. It's required to specify the Content-Type title properly.

 

Sample of response:

JSON

Content-Type  :  application/json

{
    "username" : "johndoe",
    "deviceid" : "somedeviceid"
}

 

Subscription cancellation

Subscription is cancelled in the following cases:

  • The user subscribed to events from other device;
  • Device token or registration id is changed;
  • Another user subscribed to events from this device;  
  • Subscription is cancelled manually.

DELETE 

http://example.com:[port][/somecontext]/secure/subscription/[deviceId]

Reply with “204 No Content” code means that subscribing is performed successfully.

 

APN message format

{

"aps" : {

                     "alert" : "Motion Detected",

                     "badge" : 2 //ordinal number of the message. Numbers are given one after another after the latest subscribing.

             },

     "e" : {

                "srv" : "XXX",  //server id. Unique in one iOS device

                "stt" : 88,   //state id(see The list of states for a specific object class)

                "obj" : "6", //object id

                "ts" : "2010-08-02T23:30:00Z" //time of sending the event

            }

}

  • No labels