cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to convert x-www-form-urlencoded (Postman) to WebApi

RubenGjelsten
Level 2
Hi, anyone who knows how to "convert" my Postman POST command to BP Web api format?

In Postman, the keys are in Body as x-www-form-urlencoded.

Converted to CURL (it looks like this):
curl --location --request POST 'https://xxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=xxx' \
--data-urlencode 'scope=xxx' \
--data-urlencode 'username=xxx' \

In BP Web api \ Request\ Body content \ Template, I have tried both format 'key1=[value1]'&'key2=[value2]' and JSON format like { "key1": "[value1]", "key2": "[value2]"} (Content-Type= application/x-www-form-urlencoded and application/json).

Both elternatives return HTTP 400 error (which is syntax error, I quess).



------------------------------
Ruben Gjelsten
Senior Analyst Service Management
SSV IIC RPA
Europe/London
------------------------------
16 REPLIES 16

@Jesus Jordan,

By entering a value for Common Authentication you're telling Blue Prism to handle the authentication when in fact you want to handle it yourself. Change the Common Authentication to None and then pass in the username and password as input parameters on your Get Token action. Then you can reference them in the request body.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi All,

I am facing the same issue.

Please find the Postman screenshots.

30582.png

30583.png

Could you please help me with this and show me how to setup the HTTP request to get the result.



------------------------------
Jishnu P Nair
Developer
Ey
Asia/Kolkata
------------------------------

Hi Shashank,

I tried the body format which you suggested but still I am getting the error, 
{ "error": "Invalid request" } 

Below is my API body format,
grant_type=[refresh_token]&refresh_token=[XXXXX]

whereas I tried it from POSTMAN, API working successfully with x-www-form-urlencoded content type, with below format,

grant_type:refresh_token
refresh_token:XXXXX

30591.png



------------------------------
Trupti Pardeshi
Software Developer
Wipro
UTC
------------------------------

Trupti,

What do you intend to pass in grant_type?

Value of Data Item refresh_token

or string "refresh_token"



------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------

Hi Shashank,

Value of grant_type is refresh_token ("string"), 

grant_type:refresh_token
refresh_token:XXXXX

Thanks in advance



------------------------------
Trupti Pardeshi
Software Developer
Wipro
UTC
------------------------------

Hi All,

This worked for me.

Address URL: API End URL

Body : "grant_type=client_credentials"

Content Type : "application/x-www-form-urlencoded"
User name : Client ID

Password : Client Secret

Let us know if this helped or not.

BP Version : 6.10.1

VBO: HTTP Request

Thanks,
Jishnu



------------------------------
Jishnu P Nair
------------------------------

@Trupti 

Please try as per suggestion from Jishnu. If it still doesn't work then I would suggest posting screenshot of your POSTMAN configuration here.



------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------