Using REST API with Postman examples

Hi, i try to use the REST API with Postman, but with no luck !
First, the free plan accept REST API requests ?

The info is not clear about the PORT
The protocol hhtp or https ?
So, some examples will be appreciated

Exist an API endpoint to publish a topic to my cluster ?
Exist an API endpoint to know if a client is connected ?

Thanks

Hi @GAL,

free plan doesn’t support the REST API. Currently only the dedicated plan supports REST API.

As for what endpoints exist, you can look at the docu or at the specification page: HiveMQ 4.13.0 REST API documentation

Tip, you can download the yaml file containing the REST specification from this page: HiveMQ 4.13.0 REST API documentation and then import the yaml file into Postman.

Greetings,
Michael from the HiveMQ team

1 Like

Thanks Michael
I read the API doc and can’t find an endpoint to publish a topic, that is what i need .
without that feature the API is useless to me

How can You automate pub without that ?

Regards

Hi @GAL ,

HiveMQ REST API is automating administrator actions, it supports neither Publish nor Subscribe. You must use a normal MQTT Client to connect to the broker and publish a message on a topic.

Kind regards,
Dasha from HiveMQ Team

Hi @GAL,

you are correct that this endpoint does not exist. I see two solutions to this:

  1. If you have already access to the enterprise SDK you can “simply” create your own extension that adds your own REST endpoint (this need the enterprise SDK) that then uses the PublishService.publish() (this one is in the public SDK). Note that access to the enterprise SDK needs a certification (which costs money).

  2. You don’t want to spend money → Again you need to create your own extension that implements a REST server where you then basically create your own endpoint that again uses the PublishService.

Greetings,
Michael