Organisations can have multiple domains under their Google Apps account, and each domain can have users under it. For example, the organisation domain is company.com
, but it also has parkeddomain.com
associated with it (admin console -> domains).
I want to get the list of all users, both listed under company.com
- john@company.com and parkeddomain.com
- michael@parkeddomain.com.
I'm currently using this api call:
https://www.googleapis.com/admin/directory/v1/users?domain=company.com
But it only returns users who are in the company.com
.
Question: Is there a way to return all users from all domains? If not, is there a way to get all the domains for this organisation so that I can manually iterate over them?
You can retrieve all users of a company using the customer filter (customer=my_customer).
The unique ID for the customer's Google account. In case of a multi-domain account, to fetch all groups for a customer, fill this field instead of domain. As an account administrator, you can also use the
my_customer
alias to represent your account'scustomerId
. ThecustomerId
is also returned as part of the Users resource. Either thecustomer
or thedomain
parameter must be provided.