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

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 Staff SameerCh
Power Automate Staff

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 Staff RajRa
Power Automate Staff

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 Employee

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 Staff RajRa
Power Automate Staff

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 Employee

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 Staff RajRa
Power Automate Staff

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 Staff SameerCh
Power Automate Staff

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 Employee

Re: is flow malforming my json http request body?

thanks! Can't believe I missed that!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 370 members 4,755 guests
Please welcome our newest community members: