Sending a notification to a specific device
Request
To send a notification to a specific device, send a POST request to:
http://<host>:<port>/messaging/v1/clients/{client_id}/inbox
Headers
Content-Type: application/json
Mandatory fields
client_id
(in URL) – the ID of the deviceenvelope
object containing at least:from
– who the notification is from
message
– the message – base64-encoded opaque data or UTF-8-encoded data with no CR/LFs
Note that this is client-specific. For ION clients, the message must be in this format (but with CR/LFs removed):CODE{ "data" : "{ "title":"Titles promotions message", "message":"Content promotions messages" }" "notification" : "{ "title":"Titles promotions message", "message":"Content promotions messages" }" }
The contents ofdata
andnotification
must be the same.
Example
A request with this payload sends a message to the device specified in the URL:
{
"envelope": {
"event": "subscription-changed",
"id": "b7a1e934-961a-42d4-9093-20e6d977dabc",
"app_id": 3649,
"from": "account-management-service"
},
"message": "{ \"from\" : \"remotepvr\", \"to\" : \"123456\", \"timestamp\" : \"1483768987\", \"priority\" : \"10\", \"reply-to\" : \"https://address.to.reply or node@machine:queue\", \"data\" : \"private data used by the device remote booking application\"}"
}
Response
The request returns an HTTP 200 status if the message was sent successfully.
An unsuccessful request returns an HTTP 404 status if the client ID is not recognised.
See also
For full details of this API, see the DMM API documentation.