Register Device

Registering a device to receive Push Notification messages.

In order to send a Push Notification message to a device, the device has to register to receive messages. Device registration is done by creating a registration record inside the database Devices built-in collection. Registration is done by making a request to the following endpoint:

https://api.appery.io/rest/push/reg

Parameters

Registration supports the following parameters:

ParameterDescription
AppTypeApp platform type (A – Android, I – iOS). Required.
tokenUnique app instance identifier. Required.
deviceIdUnique device identifier. Required .
X-Appery-App-IdUnique identifier of Appery.io app. The app ID can be found in the App Builder URL. For example: https://appery.io/app/project/***e51a...ad9***/edit. Required.
custom_param_nameName of custom field in _devices table.
custom_param_valueValue of custom_param_name field.
channelsList of channelId channel identifiers.

Error responses

The endpoint might respond with the following error messages:

HTTP StatusCodeDescription
400PNDR002App ID is not specified
400PNDR007Device ID must be a string
400PNDR008Token must be a string
400PNDR009Channels must be an array
400PNDR0010Channel length can’t be more than 256 symbols
400PNDR0011Type must be a string
400PNDR0012Empty token/registrationID
400PNDR0013Type must be A or I
400PNDR0014Device ID can’t be more than 256 symbols
400PNDR0015Project GUID: not found
400PNDR0016Token can’t be more than 256 symbols
400PNDR0019Channel can’t be empty
400PNDR0022Empty deviceID
400PNDR960Specified brand is not valid
Example

You can provide values for other predefined or custom fields as well:

curl -X POST 
  -H "X-Appery-App-ID: e51f973c-aad9-4102-9f39-349c25264277" 
  -H "Content-Type: application/json" 
  -d '{
        "deviceID":"356843051801093;5879669fa11e863e",
        "token":"APA91bGZvocg3LT1sOpTEaW...He-QLxN6nFOFdS1Y77b3cpVBBgxPgRBsYQZRAdOA",
        "type":"A",
        "channels":[1,3,5],
        "category":"paid",
        "timeZone":"GMT+03:00"
    }' 
  https://api.appery.io/rest/push/reg
The server returns an HTTP 200 OK status and the registered device identifier, if the device was successfully registered.

📘

deviceId and token information

The deviceId and token parameters are automatically generated device-side. These values can’t be found anywhere except in the devices collection of the Appery.io Database. Information about the device (including the deviceId and token parameters) where the app is installed, will be saved in the devices collection of the selected database as soon as the device is running the app.