cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JT_Corrin
Level: Powered On

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
JT_Corrin
Level: Powered On

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
Community Support Team
Community Support Team

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.

JT_Corrin
Level: Powered On

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
JT_Corrin
Level: Powered On

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. 

JT_Corrin
Level: Powered On

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

 

 

JT_Corrin
Level: Powered On

Re: HTTP POST Action - Bad Request

Anyone?

 

@v-litu-msft ?

JT_Corrin
Level: Powered On

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

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

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
Top Kudoed Authors
Users online (9,746)