0
votes

I want to get the IAM policy for a user using

https://cloud.google.com/resource-manager/reference/rest/v1/projects/getIamPolicy

When I enter a userid into the resource field though, I get

{ "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name \"body_resource\": Cannot find field.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "description": "Invalid JSON payload received. Unknown name \"body_resource\": Cannot find field." } ] } ] } }

What should I put in the request body to get the IAM policy for this user? Or is the error wrong and Users just dont have resource policies like this?

EDIT: To be clear, I get this error no matter what I put in the resource field

2
Try the api explorer: developers.google.com/apis-explorer/#search/policy/m/… I get the same error, I think it's broken at the momentRobert Lacok
Make this an answer so I can accept it?Forrest Keppler

2 Answers

1
votes

I think right now the UI for this API is broken and doesn't work from the browser, I get the same error.

You can however try calling it from the API explorer, or by making the call using the api client libraries as shown in the examples at the bottom of the page you linked.

1
votes

The in-page explorer did have a bug, but the fix is rolling out now.

This was caused by an issue with how the GAPI library calls APIs with a parameter called 'resource', so it should only have affected pages with such a parameter in their method.