E_T
1
Hello,
i have a problem to do a HTTP Post in Node Red.
I tested the HTTP Post with the porgramm Postman:
Server: https://arche.webuntis.com/WebUntis/jsonrpc.do
Parameter school=EBG
so Postman shows :https://arche.webuntis.com/WebUntis/jsonrpc.do?school=EBG
Postman-Body: (json) (API-documentation)
{
"id":"ID",
"method":"authenticate",
"params":
{
"user":"xy",
"password":"PASSWORD",
"client":"CLIENT"
},
"jsonrpc":"2.0"
}
I got in Postman a good Response.
.
How could i do this Post in NODERED?
A funktion Node should generate the Body-Json.
Greetings
E_T
Andrei
2
Try using below code inside a function node. Of course you want to replace the data otherwise the API will not authenticate.
The HTTP request node should have the Method field configured as "-set by msg.method-"
msg.headers = {}
msg.method = "POST"
msg.url = "https://arche.webuntis.com/WebUntis/jsonrpc.do" ;
msg.headers["content-type"] = "application/json"
msg.payload = {
"id":"ID",
"method":"authenticate",
"params":
{
"user":"xy",
"password":"PASSWORD",
"client":"CLIENT"
},
"jsonrpc":"2.0"
};
return msg
E_T
3
Thank you very much.
But where do I the Information: school=EBG?
and now there is an other problem: The node must have sl/TSL-information because it is https and not http.
The TLS-Konfiguiration needs a Certificate, i think normaly in the browser.
Greetings
E_T
E_T
4
So here the solution:
Install https-node
Then URL = https://arche.webuntis.com/WebUntis/jsonrpc.do?school=EBG
Thank you Andrei!
Greeting
E_T
There is no need to install a separate node... The core Request node handles HTTPS.
1 Like
system
Closed
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.