AdsAccount

82 views
Skip to first unread message

Anand Sumo

unread,
Feb 7, 2019, 9:21:27 AM2/7/19
to AdWords API and Google Ads API Forum
How do I get my All "Google Ads Account" details using .net?
what is the Service/Method name to achieve this?

googleadsapi...@google.com

unread,
Feb 7, 2019, 1:08:02 PM2/7/19
to AdWords API and Google Ads API Forum
Hello Anand,

To get the details of all of your Google Ads accounts (the accounts you have access to), you could use the CustomerService.getCustomers operation without specifying the Client customer id in the header. This operation will return all the accounts that the email address have access to. Please let me know if you have any further questions or if your question was different.

Regards,
Sai Teja, AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Anand Sumo

unread,
Feb 8, 2019, 4:41:10 AM2/8/19
to AdWords API and Google Ads API Forum
Hi sai,

  I am using GoogleAds API lib. and the Get customers() having a nullable parameter of "ResourceName" or "GetCustomerRequest". so how do i call this method without specifying customerid?as you explained?

Anand Sumo

unread,
Feb 8, 2019, 7:18:45 AM2/8/19
to AdWords API and Google Ads API Forum
 I am using the below Code to get the All the AdsAccount details. but selecting 5 AdsAccount details its take 36s.
how do I get all my Ads Account with a single request? kindly give me code sample also. 
 SearchGoogleAdsRequest request = new SearchGoogleAdsRequest()
                    {
                        Query = @"SELECT
                                 customer_client.resource_name,
                                 customer_client.client_customer,
                                 customer_client.level, customer_client.hidden,
                                 customer_client.level
                                 FROM customer_client",
                                 CustomerId = CustomerDetails.Id.ToString()
                    };
                    PagedEnumerable<SearchGoogleAdsResponse, GoogleAdsRow> searchPagedResponse = googleAdsService.Search(request);
                    foreach (SearchGoogleAdsResponse response in searchPagedResponse.AsRawResponses())
                    {
                        foreach (GoogleAdsRow googleAdsRow in response.Results)
                        {
                                      }   } 

googleadsapi...@google.com

unread,
Feb 8, 2019, 1:52:01 PM2/8/19
to AdWords API and Google Ads API Forum
Hello Anand,

It is not possible to get all the accounts details in a single API call via Google Ads API beta. Via Google Ads API beta to fetch the list of accessible account for your credentials. you could use CustomerService.ListAccessibleCustomers. Which will return only resource names of the accessible accounts.

The query you have used is to fetch the account hierarchy via GoogleAdsAPI beta, which will give all the resource names of the accounts under a manager account when using the CID of the manager account and the OAuth credentials of the manager while making the API call.

Since, the Get requests are heavier it is expected to take a little more time, generally it is recommended to use search query while pulling the details like these via resources. You could use the available customer fields in the customer resource and can pass each customer Id to get the respective details of that customer. Below is the sample search query to fetch the customer details via customer resource.

Query in DotNet format given below:
Query = @"SELECT
                   customer.resource_name,
                   customer.descriptive_name,
                   customer.id
                   customer.test_account,
                   customer.tracking_url_template FROM customer",
                   CustomerId = customerId.ToString() //Pass the customer Id that you found on the resource name earlier.

Please give it a try and let me know if you have any further questions.

Regards,
Sai Teja, Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Reply all
Reply to author
Forward
0 new messages