Hello
I have connected 2 MQTT nodes in NodeRed via flespi to transfer a JSON object. This works perfectly.
Now I want to access the one MQTT node from a third party program (Ninox) via REST-API using flespi to transfer a JSON object.
So far it works to transmit a string to NodeRed via the following console command:
curl -X POST --header 'Accept: application/json' --header 'Authorization: FlespiToken XXXXXXXXX' -d '{"topic": "flespiNinoxFrom", "payload": "UweG"}' 'https://flespi.io/mqtt/messages'.
From Ninox, however, the http-call must look like this:
http('POST',URL,Authorisation,Data).
I have written the following code:
let vURL := "https://flespi.io/mqtt/messages";
let vAuto := {
Accept: "application/json",
Authorization: "FlespiToken XXXXXXXXXX"
};
let data := {
topic: "flespiNinoxFrom",
payload: "UweG"
};
let response := http("POST",vURL,vAuto, data)
But get as response: {"error": "Request failed: error - "}
Is it possible to make an http call to flespi in this way, as required by Ninox?