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:

Parameter

Description

AppType

App platform type (A – Android, I – iOS). Required.

token

Unique app instance identifier. Required.

deviceId

Unique device identifier. Required .

X-Appery-App-Id

Unique 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_name

Name of custom field in _devices table.

custom_param_value

Value of custom_param_name field.

channels

List of channelId channel identifiers.

Error responses

The endpoint might respond with the following error messages:

HTTP Status

Code

Description

400

PNDR002

App ID is not specified

400

PNDR007

Device ID must be a string

400

PNDR008

Token must be a string

400

PNDR009

Channels must be an array

400

PNDR0010

Channel length can’t be more than 256 symbols

400

PNDR0011

Type must be a string

400

PNDR0012

Empty token/registrationID

400

PNDR0013

Type must be A or I

400

PNDR0014

Device ID can’t be more than 256 symbols

400

PNDR0015

Project GUID: not found

400

PNDR0016

Token can’t be more than 256 symbols

400

PNDR0019

Channel can’t be empty

400

PNDR0022

Empty deviceID

400

PNDR960

Specified 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.