Skip to content

Publish with Headers

Message headers is a collection of name/value pairs. A subscriber can set a filter expressed as an SQL "where clause" query (called selector) which Backendless uses to determine whether a message should be delivered to the subscriber. When the query matches the published data in message headers, message is delivered to the corresponding subscriber. For more information see the Conditional Delivery section of this guide.

The following example publishes a message with the city : Tokyo header:

Request

curl -H Content-Type:application/json -X POST \  
-d '{"message":"hello world!", "headers":{"city":"Tokyo"}}' \   
-v https://api.backendless.com/APP-ID/REST-API-KEY/messaging/Default

Response

{  
  "errorMessage":null,  
  "messageId":"message:37C81F70-9B7B-4CF8-FF24-3690D9054F00",  
  "status":"scheduled"  
}

The value of the messageId property can be used to obtain the message delivery status.