0

I have an API in which if I am sending POST request thru body type : form-data , i am able to see the output. Here is the successful request Form-data success

But if I use the same data in raw form, it give me this error

 "error": "invalid_request",
    "error_description": "AADB2C90083: The request is missing required parameter: grant_type.\r\nCorrelation ID: 742e7aa2-de23-4589-8b5c-c2fadbbe1537\r\nTimestamp: 2022-01-26 21:21:29Z\r\n"
}

Raw data failure

Here is what Header looks like when the request is successful header successful The reason i encountered is, if i unselect the Content-type under header at the success (first) scenario, it also gave me the same error.

I also saw this post Postman form-data works, but the raw equivalent doesn't

But this does not work for my solution

Aarti Arora
  • 3
  • 1
  • 4

2 Answers2

0

I am using Cypress to send this POST request. I solved this by adding form "true" in the function. I still am not sure how to fix this in POSTMAN

headers: 
   {
     Connection: "keep-alive",
     "Content-Type": "form-data"
   },
form: true,
Dula
  • 1,276
  • 5
  • 14
  • 23
Aarti Arora
  • 3
  • 1
  • 4
0

JSON and Form Data are completely different ways to encode data.

If your server-side program expects to receive data encoded as Form Data (and only as Form Data) then it isn't going to be able to handle you sending it JSON instead.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335