Closed thokkane closed 1 year ago
listAccessibleCustomers
will only return resource names. It's a special case in the API, a method that actually retrieves data, and isn't executed on behalf of any customer account.
Otherwise, you need to authenticate on behalf of a customer and use search to retrieve any information. Searching customer_client
will return the current customer, and (for manager accounts), also descendant accounts.
Just in case somebody else needs this, i'll ad it here.
So you can query the account information and include a "manager" field as well. This indicates if the account is a manager account, which you can use to split the account types in your app
const query =
SELECT
customer_client.id,
customer_client.descriptive_name,
customer_client.manager,
customer_client.test_account,
customer_client.status
FROM customer_client
LIMIT 20
;
var adAccounts = []
var managerAccounts = []
const stream = customer.queryStream(query);
for await (const row of stream) {
if(row.customer_client.manager) {
managerAccounts.push(row)
}
else adAccounts.push(row)
}
Is there a way to identify if the customer account is a manager account or a normal ad account? Currently the listaccessiblecustomers shows the accounts on the root level, however, doesn't show the child accounts.
Trying to detect if its a manager account on the root level and if so, then fetch the child accounts.