# HTTP Post with Parameter and Body

**URL:** <https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132>\
**Category:** General\
**Created:** [1 February 2020 11:36 UTC](https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132 "2020-02-01T11:36:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![E\_T](https://avatars.discourse-cdn.com/v4/letter/e/87869e/32.png) [@E\_T](https://discourse.nodered.org/u/E_T)\
**Post date:** [1 February 2020 11:36 UTC](https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132/1 "2020-02-01T11:36:14Z")

</div>

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](https://arche.webuntis.com/WebUntis/jsonrpc.do)

Parameter school=EBG

so Postman shows :[https://arche.webuntis.com/WebUntis/jsonrpc.do?school=EBG](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

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [1 February 2020 12:34 UTC](https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132/2 "2020-02-01T12:34:46Z")

</div>

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-"

```auto
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

```

---

<div class="post-metadata">

**Author:** ![E\_T](https://avatars.discourse-cdn.com/v4/letter/e/87869e/32.png) [@E\_T](https://discourse.nodered.org/u/E_T)\
**Post date:** [1 February 2020 14:31 UTC](https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132/3 "2020-02-01T14:31:40Z")

</div>

> [@E\_T](#):
>
> [https://arche.webuntis.com/WebUntis/jsonrpc.do](https://arche.webuntis.com/WebUntis/jsonrpc.do)

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

---

<div class="post-metadata">

**Author:** ![E\_T](https://avatars.discourse-cdn.com/v4/letter/e/87869e/32.png) [@E\_T](https://discourse.nodered.org/u/E_T)\
**Post date:** [1 February 2020 17:01 UTC](https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132/4 "2020-02-01T17:01:38Z")

</div>

So here the solution:

Install https-node  
Then URL = [https://arche.webuntis.com/WebUntis/jsonrpc.do?school=EBG](https://arche.webuntis.com/WebUntis/jsonrpc.do?school=EBG)

Thank you Andrei!

Greeting

E\_T

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2020 17:33 UTC](https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132/5 "2020-02-01T17:33:01Z")

</div>

There is no need to install a separate node... The core Request node handles HTTPS.

---

<div class="post-metadata">

**Author:** ![E\_T](https://avatars.discourse-cdn.com/v4/letter/e/87869e/32.png) [@E\_T](https://discourse.nodered.org/u/E_T)\
**Post date:** [1 February 2020 18:27 UTC](https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132/6 "2020-02-01T18:27:44Z")

</div>

Ok, i will try it!

Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 February 2020 18:27 UTC](https://discourse.nodered.org/t/http-post-with-parameter-and-body/21132/7 "2020-02-15T18:27:45Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
