Publish message via RestAPI


Hello. I have a problem with publishing messages via REST API.

When I send following request:

body: {“topic” : “my/custom/topic”, “qos” : 1, “payload”: “cXdlcnR5”, “retain” : false, “dup” : false, “tokenId” : “{{tokenId}}”}

I receive the following response:

Http code: 200
Body: Publish operation initiated

But other devices don’t receive this message. Why?

Regards, Denis


Hello Denis,

Have you subscribed to that topic before sending that message?

You need to have a device subscribed to my/custom/topic or my/custom/+ or my/+/+ or just # so it can received your message.

Otherwise, it will not be forwarded to any subscriber.

Remember that subscribed devices using QoS1 or QoS2, and using cleanSession=false, even though they are disconnected at the time the message is received, it will do receive them on next connection.

That is, keep in mind that:

a) You need to have devices subscribed with topic filters that matches your message topics

b) Those subscriptions can be received online (no matter what kind of session cleanSession=true or false), or quality of service.

c) To receive messages while disconnected you must have devices that are subscribed with at least QoS1 or QoS2 and cleanSession=false

Let us know your progress,

Best Regards,

Messages published when device was not connected are not received