Get All MQTT Subscriptions
Returns all MQTT subscriptions.
Request
HTTP Request
Permissions
Path parameters
No parameters required.
Request body
The request body is empty.
Response
This request returns a list of all current MQTT subscriptions.
The response incudes the following fields:
Field | Type | Description |
---|---|---|
owner.entityId | String | The ID of an entity that's subscribed to the MQTT message. |
owner.entityType | Integer | The type of en entity that's subscribed to the MQTT message. 1 is object, 2 is link. |
topic | String | The topic of the subscription. |
dataExpiryPeriod | Integer | The time in which this subscription expires (in milliseconds). Is included in the response only if set. |
Note
The dataExpiryPeriod
field is only included in the response if it has been defined.
Example
Request
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/mqtt/subscriptions";
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Authorization", auth);
let requestOptions = {
method: "GET",
headers: headers
};
fetch(saymonHostname + path, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log("error", error));
const http = require("http");
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/mqtt/subscriptions";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "GET",
"hostname": saymonHostname,
"headers": {
"Authorization": auth
},
"path": path
};
let req = http.request(options, function (res) {
let chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
let body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();