cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

is flow malforming my json http request body?

I keep getting an error that indicates that my http request is missing a parameter, but input clearly indicates that the parameter has been passed. Is it possible that the JSON is being malformed somehow? Or am I missing something? See attached.

badrequest.JPG

 

Edit:

To answer some possible questions: (1) I'm authenticating to CRM because the actions I need to use are not exposed by Flow Actions (2) I've tried this exact same request in Postman and got a successful reply. I copy/pasted the values into Flow.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Automate
Power Automate

Re: is flow malforming my json http request body?

It is because of the content type as Raj pointed out.  If you need to send a "application/x-www-form-urlencoded" payload you will need to send the body like the following:

grant_type=password&username=<url-encoded-username>&...

 

that should work.

View solution in original post

7 REPLIES 7
Highlighted
Power Automate
Power Automate

Re: is flow malforming my json http request body?

can you send me the flow you used like so I can look it up

https://flow.microsoft.com/manage/flows/2ff01333-0ccb-450a-8aac-499da85766ce

 

Thanks

 

 

 

Highlighted
Microsoft
Microsoft

Re: is flow malforming my json http request body?

Sorry I'm just following up on this; I put this flow on the back burner for a while.

 

The flow id is: 90a21ba7-0344-47bb-bdd6-5093bc017abf

Highlighted
Power Automate
Power Automate

Re: is flow malforming my json http request body?

We've made a lot of chagnes since you posted. Have you retried to see if this is still an issue?

Highlighted
Microsoft
Microsoft

Re: is flow malforming my json http request body?

I did. Output below. Looks like the same result as before:

 

REASON
  • Code
    BadRequest

INPUTS
  • Method
    POST
  • URI
  • Body
    {
       "grant_type": "password",
       "username": "[---------]",
       "password": "[---------]",
       "client_id": "[---------]",
       "resource": "https://[---------].crm.dynamics.com",
       "client_secret": "[---------]"
    }
  • Headers
    { "Cache-Control": "no-cache",
      "Content-Type": "application/x-www-form-urlencoded" }

OUTPUTS
  • Status code
    400
  • Headers
    {
       "Pragma": "no-cache",
       "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
       "X-Content-Type-Options": "nosniff",
       "x-ms-request-id": "c82f03f1-d0b9-416a-a11a-6187389e878e",
       "Cache-Control": "no-store, no-cache",
       "P3P": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"",
       "Set-Cookie": "x-ms-gateway-slice=006; path=/; secure; HttpOnly,stsservicecookie=ests; path=/",
       "Server": "Microsoft-IIS/8.5",
       "X-Powered-By": "ASP.NET",
       "Date": "Fri, 20 Jan 2017 19:35:29 GMT",
       "Content-Length": "435",
       "Content-Type": "application/json; charset=utf-8",
       "Expires": "-1"
    }
  • Body
    {
       "error": "invalid_request",
       "error_description": "AADSTS90014: The request body must contain the following parameter: 'grant_type'.
              Trace ID: c82f03f1-d0b9-416a-a11a-6187389e878e
              Correlation ID: feaf509b-055b-494f-93ea-4ec7fe014d81
              Timestamp: 2017-01-20 19:35:29Z",
       "error_codes": [ 90014 ],
       "timestamp": "2017-01-20 19:35:29Z",
       "trace_id": "c82f03f1-d0b9-416a-a11a-6187389e878e",
       "correlation_id": "feaf509b-055b-494f-93ea-4ec7fe014d81"
    }
 
Highlighted
Power Automate
Power Automate

Re: is flow malforming my json http request body?

HI,

 

I'm unable to find your flow (did you delete it?) - And also have trouble recreating your exact scenario. One thing I noticed is your content type is incorrect - should it be applicatoin/json?

thanks

 

Highlighted
Power Automate
Power Automate

Re: is flow malforming my json http request body?

It is because of the content type as Raj pointed out.  If you need to send a "application/x-www-form-urlencoded" payload you will need to send the body like the following:

grant_type=password&username=<url-encoded-username>&...

 

that should work.

View solution in original post

Highlighted
Microsoft
Microsoft

Re: is flow malforming my json http request body?

thanks! Can't believe I missed that!

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,411)