Converting Curl into a Post request

I am trying to connect to an API via Post request. The equivalent Curl would be:

curl --location --request POST ‘’ --header ‘Content-Type: application/x-www-form-urlencoded’ --data-urlencode ‘username=xxx’ --data-urlencode ‘password=xxxx’ --data-urlencode ‘grant_type=password’ --data-urlencode ‘scope=openid’

With the Curl in Powershell I get a positive answer. However I must be doing something wrong on my Post Request in which I entered…

This is what I get:

would you know what am I doing wrong?


1 Like

Hi @Charlie20 ,

What’s wrong is that you are not passing everything that you are passing via curl.
In your POST request, you are only taking care of POST ‘’ --header ‘Content-Type: application/x-www-form-urlencoded’.

But you are not passing any data, which is the --data-urlencode ‘username=xxx’ --data-urlencode ‘password=xxxx’ --data-urlencode ‘grant_type=password’ --data-urlencode ‘scope=openid’ part

These need to go in the Request Body tab, as a Json string. The --data-urlencode option will basically do a urlencode on the data, so you would need to do this before hand, and then pass the urlencoded data in the json.

However, if you do not need to urlencode anything, as a test, you can just pass the data as is, like this:


Of course, you need to add the proper username and password values.


Dear @bruno29a ,

Thank you very much for trying to help in my struggle with this node.

I tried your solution with different options but it does not seem to work.

Just for clarification: on my original attempt I was entering the username and password in the Authentication tab of the node. So I assume that this did not need to be typed again on the body. Would this be correct?

However, what I am uncertain about is how to consider the “grant_type” and “scope” pieces of data. Is that already assumed in the authentication tab or do they need to be entered into the “Request body” one? I tried also to enter those ones in the Request body and the user and pass on the Authentication tabe but it did not work. In the Authentication tab I used the option “basic”.

Any ideas?

Hi @Charlie20 have you tried what was suggested?

Yep. I tried 3 options:

  1. With the request body tab scrpit and the Authentication tab filled in as well
  2. With the request body tab scrpit and the Authentication tab with no credentials
  3. With the request body using the grant_type and scope data and the Authentication tab with credentials.

None work unfortunately.

However a colleague of mine suggested replacing application/x-www-form-urlencoded in the Content-Type by “application/json” which actually worked.

No clue as to why.

Hi @Charlie20 yes you have to use “application/json” as the body that I provided is a json type. I assumed that you were using that.

1 Like

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