Opteo/google-ads-node

How do I do get a list of all google accounts? (ListAccessibleCustomers)

Sotacan opened this issue · 3 comments

I'm submitting a ...

  • bug report
  • feature request
  • question about the decisions made in the repository
  • question about how to use this project

Summary

Google docs:
https://developers.google.com/google-ads/api/docs/account-management/listing-accounts

Need to be able to return the Google Ad accounts associated with a google account. Is there currently a way todo this? much appreciated ahead of time!

If you're using this library, google-ads-node, then you could try this snippet posted in a similar issue:

const response: string[] = await new Promise((resolve, reject) => {
  service.listAccessibleCustomers(request, (err: any, result: any) => {
    if (err) {
      reject(err);
    } else {
      resolve(result.resourceNames);
    }
  });
});

Ref: #35

@kritzware any idea why this would return an empty array? (The managedCustomerService version from the old Adwords API returns 3 items and I thought these functions were equivilant)

// get sub accounts
let customerClients = await customer.customerClients.list()
console.log('customerClients');
console.log(customerClients);
//Adwords API version that returns 3 items in array
const managedCustomerService = adwordsService.getService('ManagedCustomerService');
return await managedCustomerService.getAll();

Thanks so much again, this is my final issue I think.

That methods seem to work fine for me. Are you definitely passing in the correct authentication? The correct login_customer_id (if required)?