cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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

 

 

 

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

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?

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"
    }
 
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

 

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

Microsoft
Microsoft

Re: is flow malforming my json http request body?

thanks! Can't believe I missed that!

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (8,782)