0

When call API with Content-Type: as application/x-www-form-urlencoded I always get Bad request(Status code 400).

If I paste same details in Postman it's work without any issue.

I am assuming body must be formatting before sending request!

HTTP POST Logic App

Update 1 I need to add prefix updateorder=" somehow in front of json payload and Json payload should not convert to text.

enter image description here

if I use concat OR put updateorder= just befor json payload its convert into text as per below and request is invalid.

Using replace from "\"" to "" does not work as well as its again convert json payload into text so request is invalid in this scenraio as well. enter image description here

quantum07
  • 33
  • 3
  • Check your body against this example … https://stackoverflow.com/questions/45554887/azure-logic-app-how-to-make-a-x-www-form-encoded … yours looks different. – Skin Sep 26 '22 at 11:29
  • Body request as per below and it's work perfectly ok when copied to postman as mention before. Body is fine and this is how 3rd party API designed. updateorder= {"action":"UO", "orderdetails" { "OrderID":"12345", "PID":"PROD123" } } – quantum07 Sep 26 '22 at 15:00

1 Answers1

0

I have created logic app with your requirements. Here is reference image for that:

enter image description here

I call the API in content-type using your code body, I also got same error code. Case-1:

I tried with

{
"updateOrder": {
"id": "1",
"orderDetails": {
"name": "sam",
"sal": "1000"
}
}
}

It worked successfully for me I got success code 201, and it is not converting into text also.

Here is the reference image:

enter image description here

So, you can try these changes in your BODY After updateorder instead of equals to (=) you should try semi colon (:).

Case-2:

After trying Case-1 still you're getting error once check this and try if you are trying to get any token for authentication and if you are sending credentials in body then use this Instead of Content-Type use "Accept" (Enter key) and instead of application/x-www-form-URL encoded use "* / *"(Enter value)

Enter Key: Accept
Enter value: */*

Here is the reference image for that:

enter image description here

Bhavani
  • 1,725
  • 1
  • 3
  • 6