MQTT Broker REST API Documentation

Introduction:


While building IoT application, there is a need to control and manage the edge devices from the manager application. This API will help you control your edge devices via the REST API. You an send messages, add new authentication keys, get client detials and do more via the API.

Clientsend

Send message to the particular client based on the client ID. This can be sent to a client that has subscribed or not subscribed to the topic.

Method:

POST


http://(Server-IP):8080/clientsend

Parameter:

Parameter Value Detail
clientid Client id or device id to which the message needs ot be sent.
topic Publish topic to which the particular client is subscribed to.
message Message to be sent
QoS QoS Level (Optional). If not set, QoS will be 0
retain Retain Flag (Optional), If not set, Retain will be 0

Response:

On Success:

 									
    'Message has been sent to (Client_ID)'
                      

On Failure:

    'Message could not be delivered to (Client_ID)'
                      

Parameters are missing

     ' The required parameter is missing - (Parameter Name)'            
                      

Sendall

Send message to all the devices who subscribed to the Published topic.

Method

POST


http://(Server-IP):8080/sendall  

Parameter:

Parameter Value Detail
topic Publish topic to which the particular client is subscribed to.
message Message to be sent
QoS QoS Level (Optional). If not set, QoS will be 0
retain Retain Flag (Optional), If not set, Retain will be 0

Response:

On Success:

                                          
    'Message has sent to subscribers of topic - (topic)'
                      

On Failure:

    'Message could be delivered to subscribers of topic - (Topic)'
                      

Parameters are missing

     ' The required parameter is missing - (Parameter Name)'            
                      

Add Authenticaton

Automatically add Authentication credentials to MQTT Broker when Authentication Enabled.

Method

POST


http://(Server-IP):8080/addauth  

Parameter:

Parameter Value Detail
username username to be added
password password to be added for the given username

Response:

On Success:

                           
    '('Auth has been added'-'(username)')'
                      

On Failure:

    '('Auth hasnt added'-'(username')'
                      

Parameters are missing

     ' The required parameter is missing - (Parameter Name)'            
                      

Remove Authenticaton

Automatically remove Authentication credentials to MQTT Broker when Authentication Enabled.

Method

POST


http://(Server-IP):8080/removeauth  

Parameter:

Parameter Value Detail
username username to be removed
password password to be removed for the given username

Response:

On Success:

                 
    '('Auth has been removed'-'(username)')'
                      

On Failure:

    '('Auth hasnt removed' - '(username')'
                      

Parameters are missing

     ' The required parameter is missing - (Parameter Name)'            
                      

Connected Device List

List all Connected Device.

Method

GET


http://(Server-IP):8080/connecteddevices  

Response:

When Device Connected:

                    
    '{"clientno1":"clientid1" , "clientno2" : "clientid2"}'
                      

When Device not connected

    '{}'
                      

Parameters are missing

     ' The required parameter is missing - (Parameter Name)'            
                      

Client Count

Automatically remove Authentication credentials to MQTT Broker when Authentication Enabled.

Method

GET


http://(Server-IP):8080/graph/client_count

Response:

When Device Connected:

                     
    '{"clientcount": (no of devices)}'
                      

When no devices are connected:

    '{}'
                      

Parameters are missing

     ' The required parameter is missing - (Parameter Name)'