This section describes APIs to add devices to MPush and associate them with topics. Only clients (e.g. apps) should implement these APIs or use mobile SDKs.
curl https://app.mpush.cloud/api/tokens-X POST-H "Accept: application/json"-H "Content-Type: application/json"-H "X-MPush-Token: <token>"-H "X-MPush-Version: 2"-d <data>
To register a new device token.
This API requires a JSON payload.
POST https://app.mpush.cloud/api/tokens
Payload example to register a device to 3 topics:
{"token": "<token>","platform": "ios","device_id": "<device ID>"}
Name | Type | Required | Description |
token | string | Yes | Specify token device obtained from APNS and FCM. |
platform | string | Yes | Specify the device platform. Values are ios and android. |
device_id | string | Yes | Specify the unique device ID. It's used to update the token in case of change. |
On success is returned an HTTP 200 and JSON like this:
{"status_code": 0}
curl https://app.mpush.cloud/api/register-X POST-H "Accept: application/json"-H "Content-Type: application/json"-H "X-MPush-Token: <token>"-H "X-MPush-Version: 2"-d '<JSON payload>'
To register a device to one or more topics.
A topic can represent either a device or a list of devices. If the specified topic doesn't exist they will be created.
This API requires a JSON payload.
POST https://app.mpush.cloud/api/register
Payload example to register a device to 3 topics:
{"topics": ["all", "ios", "user.1"],"device_id": "<device ID>"}
Key | Type | Required | Description |
topics | array | Yes | Contains a list of all topics to register the device to. |
device_id | string | Yes | Specify the unique device ID. |
On success is returned an HTTP 200 and JSON like this:
{"status_code": 0}
curl https://app.mpush.cloud/api/unregister-X POST-H "Accept: application/json"-H "Content-Type: application/json"-H "X-MPush-Token: <token>"-H "X-MPush-Version: 2"-d '<JSON payload>'
To unregister a device from one or more topics.
If the specified topic doesn't exist they will be ignored.
This API requires a JSON payload.
POST https://app.mpush.cloud/api/unregister
Payload example to unregister a device from 2 topics:
{"topics": ["all", "ios"],"device_id": "<device ID>"}
Key | Type | Required | Description |
topics | array | Yes | Contains a list of all topics to register the device to. |
device_id | string | Yes | Specify the unique device ID. |
On success is returned an HTTP 200 and JSON like this:
{"status_code": 0}
curl https://app.mpush.cloud/api/unregister-all-X POST-H "Accept: application/json"-H "Content-Type: application/json"-H "X-MPush-Token: <token>"-H "X-MPush-Version: 2"-d '<JSON payload>'
To unregister a device from all topics.
This API requires a JSON payload.
POST https://app.mpush.cloud/api/unregister-all
Payload example to unregister a device from all topics:
{"device_id": "<device ID>"}
Key | Type | Required | Description |
device_id | string | Yes | Specify the unique device ID. |
On success is returned an HTTP 200 and JSON like this:
{"status_code": 0}