Http post request

Hi there,

Im trying to make a post request with body:
1)form_urlencoded
2)json

I have already managed to make a get request and getting the response and also to traverse through it.

Any help will be appreciated, which nodes will help me to achieve this?Function node and change? Any example will be appreciated.
Thanks!

[I have already checked the cookbook]

UPDATE:
An additional issue that I have is, trying to play with the function node and inside the node im calling the fetch in order to make http request and it outputs "fetch is not defined"

The code is:

async function bring(){
const resp = await fetch('https://jsonplaceholder.typicode.com/posts');
const fata = await resp.json();
console.log(data);
}
bring();

Hi @lastm4n,

You have to use the "http request" node. Set it to "POST" and set the URL.
In a function node OR a change node before, you can set the payload such as :

msg.payload = {
  "key_1": "value_1"
};
msg.headers = {
  /* if needed */
}

Is it what's you're looking for?

2 Likes