Hello,
I always get following error when trying to send HTTP.POST request:
ZitatReturn: {"body":"{\"isok\":false,\"errors\":{\"invalid_header\":\"Unauthorized! Wrong authorization header provided!\",\"invalid_token\":\"The login information is invalid! Please login again!\"}}"
The curl command that works is:
Code
curl -X POST https://shelly-xx-eu.shelly.cloud/scene/enable?id=xxx -d "enabled=false&auth_key=xxx"
I tried several formats, my recent try is:
Code
let postData = {
url: 'https://shelly-xx-eu.shelly.cloud/scene/enable?id=xxx',
body: 'enabled=true&auth_key=xxx',
headers: 'content_type=text/plain'
};
Shelly.call(
"HTTP.POST",
postData,
function (response) {
let rpcCode = response.code;
print("Return: ", JSON.stringify(response));
},
this
);
Alles anzeigen
what's wrong?
Many thanks for help!