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

HTTP POST Action - Bad Request

Hello,

 

Stumped with an error message in a http post request to MS Graph - Groups endpoint.

 

Error message says I need to add a content-type in the header but I have already done this - and in fact you can actually see the content-type header in the error:

 

error.PNG

 

Why is this happening?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper I
Helper I

Re: HTTP POST Action - Bad Request

Had to go to microsoft support for this one.

 

I have not tested it yet (and I won't get chance to for a while) but for anyone else looking at the graph api and wondering how to format the body of a http POST request, you need to do a concat on the elements of the key, so the body would look something like this:

 

{

    "concat('@', 'odata.id')": "https://...etc etc"

}

View solution in original post

6 REPLIES 6
Highlighted
Community Support
Community Support

Re: HTTP POST Action - Bad Request

Hi @JT_Corrin,

 

Could you share the configuration of your Flow? You can have a try the following configuration of the header:

Annotation 2020-01-17 100411.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted
Helper I
Helper I

Re: HTTP POST Action - Bad Request

Thanks for the response, @v-litu-msft 

 

I am taking values from Powerapps and setting Groups ownerships in Flow using group IDs and member IDs. I am ultimately using this method: https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/Extend-Microsoft-Flow-with-the-Mic...

 

And I have also tried the method using the 'secret' method of authentication.

 

Here is another shot:

 

error2.PNG

 

Getting the authorization token is successful. Now I have updated my header as per your suggestion i get the error response: "Request Type Not Supported"

 

{
"error": {
"code": "BadRequest",
"message": "Request type is not supported.",
"innerError": {
"request-id": "28710a3f-16f9-4c07-ab68-6ef67f5e64b8",
"date": "2020-01-17T07:36:09"
}
}
}
 
Thanks for your support
Highlighted
Helper I
Helper I

Re: HTTP POST Action - Bad Request

Turns out the group id was different to the ID i was using. I should have been using ExternalDirectoryObjectID. As far as I can see this is mentioned nowhere in the api docs. 

 

The flow then prompted me to remove the ";odata=verbose" from my content type and accept header. 

Highlighted
Helper I
Helper I

Re: HTTP POST Action - Bad Request

Now it turns out that the above, although able to GET the group, it is not able to POST a member ID as owner. 

 

@v-litu-msft  How can I do this:

 

https://docs.microsoft.com/en-us/graph/api/group-post-owners?view=graph-rest-1.0&tabs=http

 

Quote:

 

 

POST https://graph.microsoft.com/v1.0/groups/{id}/owners/$ref

Content-type: application/json

Content-length: 30

{

"@odata.id": "https://graph.microsoft.com/v1.0/users/{id}"

}

 

 

 

In Flow? I can't use the @ value in the https body

 

 

Highlighted
Helper I
Helper I

Re: HTTP POST Action - Bad Request

Anyone?

 

@v-litu-msft ?

Highlighted
Helper I
Helper I

Re: HTTP POST Action - Bad Request

Had to go to microsoft support for this one.

 

I have not tested it yet (and I won't get chance to for a while) but for anyone else looking at the graph api and wondering how to format the body of a http POST request, you need to do a concat on the elements of the key, so the body would look something like this:

 

{

    "concat('@', 'odata.id')": "https://...etc etc"

}

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new 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!

Top Solution Authors
Top Kudoed Authors
Users online (5,721)