To update the device, send a PUT request to the associated URL with the device ID at the end:
https://api.appery.io/rest/push/reg/<deviceId>
The update device service is for updating information about any device stored in the Devices collection. This service can be used for updating any collection field. For example, it can be timeZone, channels or category (which is a user-defined field).
Parameters
The endpoint has the following parameters
Argument | Description |
---|---|
type | Application 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 application. 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 | PNDU002 | App ID not specified |
404 | PNDU006 | Device ID: not found |
404 | PNDU015 | Project GUID: not found |
400 | PNDU960 | Specified brand is not valid |
Example
The following example shows how to update channels column of the specific device. The channels column of the predefined Devices collection has an array type. Any new value for this column must be also sent as an array. Any other parameter can be updated the same way.
The X-Appery-App-Id header is a necessary parameter for this request. Other fields are optional. You can specify any field that exists in the Devices collection.
curl -X PUT
-H "Content-Type: application/json"
-H "X-Appery-App-Id: e51f973c-aad9-4102-9f39-349c25264277"
-d '{
"channels":[1,2,6]
}'
https://api.appery.io/rest/push/reg/<deviceId>