MQTT REST Bridge
MQTT REST Bridge gives user the possiblity to send POST
request to the server and transfer payload to the specific topic.
Send request
Send data to the specific topic using options and credentials
URL : https://api.iotaap.io/v1/mqtt-rest
Method : POST
Auth required : NO
Headers
- Content-Type
(string)
: application/json - Username
(string)
: MQTT Instance username - Password
(string)
: MQTT Instance password - Topic
(string)
: Topic to transfer data to - Retain
(string)
: true/false - Qos
(string)
: 0/1/2
Retained message
If Retain
header is not provided, default value of false
will be used.
QoS
QoS (Quality of Service) can be configured in this request. If Qos
header is
not provided, default value of 0
will be used.
Body
Body can be JSON formatted message that will be sent to the defined topic
Body example
{
"start": 80,
"stop": 23,
"idle": "min",
"regulator": {
"P": 23,
"I": 56,
"D": 10
}
}
Root topic
Root topic (your username) is automatically included in the request. You only have to pass the target topic.
For the above example you could use topic /oLP6MA9r/motor-speed
. Leading /
must be included.
Success Response
Code : 200 OK
Response example
{
"message": "Message published"
}
Error Responses
Condition : System timeout
Code : 400 BAD REQUEST
Payload transfer timeout
If there is no positive response from the MQTT server, or there was an issue with initial server connection, message transfer request will be terminated after 5s.
Content :
{
"message": "There was a problem connecting MQTT server"
}
Condition : Mandatory header is missing
Code : 400 BAD REQUEST
Content :
{
"message": "<header-name> is mandatory header"
}
Condition : There is an issue with MQTT server communication
Code : 500 INTERNAL SERVER ERROR
Content example :
{
"error": "Error",
"message": "Connection refused: Not authorized"
}