I have been trying to use the api to add user of project editor in Google Cloud Platform.
API I use is Resource Manager API setIampolicy
.
To Add user is using Google Apps Script.
PROCEDURE
- get current all policy on Google Cloud Platform by using [Resource Manager API getIampolicy].
- add user and fix 1.response json.
- post 2.json using [Resource Manager API setIampolicy].
https://cloud.google.com/resource-manager/reference/rest/v1/projects/getIamPolicy
https://cloud.google.com/resource-manager/reference/rest/v1/projects/setIamPolicy
but, I can't add user. With the below Error/Exception:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.cloudresourcemanager.v1.ProjectIamPolicyError",
"type": "SOLO_REQUIRE_TOS_ACCEPTOR",
"role": "roles/owner"
}
]
}
}
Other information I can do by [Try it!] of documents, but can't do by Google Apps Script.
I use OAuth Library of Google Apps Script and OAuth Authentication.
Why?