Reputation: 1833
Intro:
There is a project.list method in the Google Resource Manager API. One can simply perform:
GET https://cloudresourcemanager.googleapis.com/v1/projects
with appropriate authentication and retrieve the list of projects associated with the account. Easy. Accounts belonging to an organization have appropriate parent
set
"parent": {
"type": "organization",
"id": "123456789012"
}
accounts not being under any organization have just no parent
node present at all.
There is also latest version of this API: V3. It requires the parent
to be explicitly specified for the project.list method (otherwise 403 Forbidden
with PERMISSION_DENIED
is returned). This seems to be extremely inconvenient.
Questions:
parent
(for V3)?organizations/123456789012
, what should be passed for non-organizational accounts?Note:
Looks like the organizational account can use:
GET https://cloudresourcemanager.googleapis.com/v3/organizations:search
To determine its own organization(s?).
Upvotes: 1
Views: 77
Reputation: 1833
Ok, I was too fixed to the project.list having the answer next to it... The project.search (with no extra parameters) is the desired project list:
GET https://cloudresourcemanager.googleapis.com/v3/projects:search
Works for both account types.
Upvotes: 2