cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JT_Corrin
Helper II
Helper II

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

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
v-litu-msft
Community Support
Community Support

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.

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

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. 

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
Helper II
Helper II

Anyone?

 

@v-litu-msft ?

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,057)