Problem with pull message using REST API


I am trying to get some message from a specific topic using REST API. Lets say, i have a retained message A on topic B, if I use POST /pull - as mentioned in the link “”, am I supposed to get the message A in response, or am I getting things wrong somewhere? I have log in and subscribe to the topic using the same tokenid, and all are ok, but when i try /pull, the server respond me with an empty string!
Thank you for your time.


Hello @ngocngokK,

You are right. After subscribe through the Web API you should receive any retained message matching that topic so the can be pulled as you describe.

We have applied several changes so now it works as expected.


Great work! Now it works perfectly. Thanks for your support!



I’m trying to reach retained messages of subscribed topic by POST /pull. Login, pull using received token and logout (as I understood @ngocngokK were subscribing before pull every time due to disabled “Connection replace” ). But it returns empty string for me. /get-subscriptions and /publish work fine with same manner.

Is that possible to share some example of “good practices” of using /pull to see messages for web client using REST API please? Maybe it can help me to catch my fault …

thanks in advance+



Keep in mind the following to receive retained messages, no matter if you are using HTTP /pulll API or MQTT connection, and also how it relates to QoS0 messages (which also affects): RETAIN
Position: byte 1, bit 0.

If the RETAIN flag is set to 1, in a PUBLISH Packet sent by a Client to a Server, the Server MUST store the Application Message and its QoS, so that it can be delivered to future subscribers whose subscriptions match its topic name [MQTT-3.3.1-5]. When a new subscription is established, the last retained message, if any, on each matching topic name MUST be sent to the subscriber [MQTT-3.3.1-6]. If the Server receives a QoS 0 message with the RETAIN flag set to 1 it MUST discard any message previously retained for that topic. It SHOULD store the new QoS 0 message as the new retained message for that topic, but MAY choose to discard it at any time - if this happens there will be no retained message for that topic [MQTT-3.3.1-7]
See the following:

In essence, to have retained messages working (with HTTP API or MQTT): you have to send a SUBSCRIBE message matching the topic after the retained message has been PUBLISHed.

So, to have your case working, follow:

  1. PUBLISH+retained
  2. …then SUBSCRIBE
  3. …and then API /pull call.

Try all this and let us know,
Best Regards,