AdGroupService service returns zero entries

70 views
Skip to first unread message

Tatiana Bursova

unread,
Oct 21, 2019, 11:07:31 AM10/21/19
to AdWords API and Google Ads API Forum
Hello there,

I am trying to get list of all ad groups associated with my customer id, I am using the following code to do that:

            using (var service = (AdGroupService)user.GetService(AdWordsService.v201809.AdGroupService))
            {
                var selector = new Selector()
                {
                    fields = new string[] {AdGroup.Fields.Id, AdGroup.Fields.Name},
                };
                var entries = service.get(selector);

                return entries.entries;
            }

but it returns zero entries.

In the web UI interface I can see active ad groups. What am I doing wrong.


Google Ads API Forum Advisor Prod

unread,
Oct 21, 2019, 12:32:38 PM10/21/19
to tat...@sightly.com, adwor...@googlegroups.com

Hi Tatiana,

Thank you for reaching out. You can follow this example for getting the ad groups from your account (just remove the campaign ID filter). If that doesn't work, please provide the client customer ID of the account you're making the call on and the complete SOAP logs for your request so that we can investigate further. See here for more details on how to enable logging.

Regards,
Anthony
Google Ads API Team



ref:_00D1U1174p._5001UKNyin:ref

Tatiana Bursova

unread,
Oct 22, 2019, 2:23:16 PM10/22/19
to AdWords API and Google Ads API Forum
Hi,

Thank you for your response, but as you can see I'm already using these examples (for C#/.net).

My code:

            var user = new AdWordsUser();
           
(user.Config as AdWordsAppConfig).ClientCustomerId = "4919245199"; // CID which has 130 ad groups displayed in web ui
           
(user.Config as AdWordsAppConfig).DeveloperToken = ...;
           
(user.Config as AdWordsAppConfig).OAuth2ClientId = ...;
           
(user.Config as AdWordsAppConfig).OAuth2ClientSecret = ...;
           
(user.Config as AdWordsAppConfig).OAuth2RefreshToken = ...;



           
using (var service = (AdGroupService)user.GetService(AdWordsService.v201809.AdGroupService))
           
{
               
var selector = new Selector()
               
{

                    fields
= new string[] {AdGroup.Fields.Id, AdGroup.Fields.Name, AdGroup.Fields.CampaignId, AdGroup.Fields.AdGroupType},

               
};
               
var entries = service.get(selector);


               
return entries.entries;
           
}


it returns:

 entries {Google.Api.Ads.AdWords.v201809.AdGroupPage} Google.Api.Ads.AdWords.v201809.AdGroupPage
 
PageType "AdGroupPage" string
 entries
null Google.Api.Ads.AdWords.v201809.AdGroup[]
 totalNumEntries
0 int
 totalNumEntriesSpecified
true bool
 
Non-Public members


I've enabled logs and here are results:


AdsClientLibs.SummaryRequestLogs Information: 1 : Request made: Host: adwords.google.com, Service: AdGroupService, Method: get, clientCustomerId: , Request ID: 00059583c806cfef0a012559360cbafd, ResponseTime(ms): 385, OperationsCount: 1, IsFault: False, FaultMessage:


AdsClientLibs.DetailedRequestLogs Verbose: 1 :
-----------------BEGIN API CALL---------------------


Request
-------


POST
/api/adwords/cm/v201809/AdGroupService
Authorization: REDACTED
Accept-Encoding: gzip, deflate
TimeStamp: Tue, 22 Oct 2019 11:15:13 GMT




<?xml version="1.0" encoding="utf-16"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 
<s:Header>
   
<RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
     
<clientCustomerId>4919245199</clientCustomerId>
      <developerToken>REDACTED</
developerToken>
     
<userAgent>unknown (AwApi-DotNet/24.8.0, Common-Dotnet/9.5.0, .NET CLR/4.0.30319.42000, , gzip)</userAgent>
   
</RequestHeader>
  </
s:Header>
 
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   
<get xmlns="https://adwords.google.com/api/adwords/cm/v201809">
     
<serviceSelector>
       
<fields>Id</fields>
        <fields>Name</
fields>
       
<fields>CampaignId</fields>
        <fields>AdGroupType</
fields>
     
</serviceSelector>
    </
get>
 
</s:Body>
</
s:Envelope>


Response
--------


Date: Tue, 22 Oct 2019 18:15:13 GMT
Cache-Control: max-age=0, private
X
-Content-Type-Options: nosniff
X
-Frame-Options: SAMEORIGIN
X
-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="46,43",h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
Transfer-Encoding: chunked
Content-Type: text/xml; charset=UTF-8
Expires: Tue, 22 Oct 2019 18:15:13 GMT
TimeStamp: Tue, 22 Oct 2019 11:15:13 GMT




<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 
<soap:Header>
   
<ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
     
<requestId>00059583c806cfef0a012559360cbafd</requestId>
      <serviceName>AdGroupService</
serviceName>
     
<methodName>get</methodName>
      <operations>1</
operations>
     
<responseTime>385</responseTime>
    </
ResponseHeader>
 
</soap:Header>
  <soap:Body>
    <getResponse xmlns="https:/
/adwords.google.com/api/adwords/cm/v201809">
      <rval>
        <totalNumEntries>0</totalNumEntries>
        <Page.Type>AdGroupPage</Page.Type>
      </rval>
    </getResponse>
  </soap:Body>
</soap:Envelope>
-----------------END API CALL-----------------------

Best

Google Ads API Forum Advisor Prod

unread,
Oct 22, 2019, 3:28:41 PM10/22/19
to tat...@sightly.com, adwor...@googlegroups.com

Hi Tatiana,

Looking at your account, all of your campaigns are Video campaigns. Unfortunately, as stated here, you can only get Video campaign data from reports. This is why you're not returning any data from that example.



Regards,
Anthony
Google Ads API Team



ref:_00D1U1174p._5001UKNyin:ref
Reply all
Reply to author
Forward
0 new messages