CampaignService get always returning null with no error

37 views
Skip to first unread message

ccwwmanager

unread,
Jul 20, 2019, 9:36:45 AM7/20/19
to AdWords API and Google Ads API Forum
Hello, 

i hope someone can help me.

I am successfully downloading a video performarce report and after i am trying to get more information about the campaigns. 
For this i am using the CampaignService and i am passing the ids of the campaigns from the previous report, but i always get no entries without error or exception.

I have tested to get all the campaigns, without predicates, but the result is the same.

This is my code:

 
public IEnumerable<Campaign> GetAdCampigns()
       
{


           
AdWordsUser user = new AdWordsUser(new AdWordsAppConfig()
           
{
               
DeveloperToken = "MyDeveloperToken",
               
OAuth2ClientId = "MyAccountClientId",
               
OAuth2ClientSecret = "MyAccountSecret",
               
OAuth2Mode = OAuth2Flow.APPLICATION,
               
ClientCustomerId = "MyClientCustomerId",
               
OAuth2RefreshToken = "MyOAuth2RefreshToken",
               
UserAgent = "microsoft-socialinsights:ReportDownloader:V3.2"
           
});
           
List<Campaign> campaigns = new List<Campaign>();
           
           
using (CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201809.CampaignService))
           
{
               
Selector selector = new Selector()
               
{
                    fields
= new string[]
                   
{
                           
Campaign.Fields.Id,
                           
Campaign.Fields.Name,
                           
Campaign.Fields.StartDate,
                           
Campaign.Fields.EndDate
                   
},                                    
                    paging
= Paging.Default
               
};


               
CampaignPage page = new CampaignPage();


               
try
               
{
                   
do
                   
{
                       
// Get the campaigns.
                        page
= campaignService.get(selector);


                       
// Display the results.
                       
if (page?.entries != null)
                       
{
                            campaigns
.AddRange(page.entries);
                       
}


                        selector
.paging.IncreaseOffset();
                   
} while (selector.paging.startIndex < page.totalNumEntries);


               
}
               
catch (Exception e)
               
{
                   
throw new System.ApplicationException("Failed to retrieve campaigns by ids", e);
               
}
           
}


           
return campaigns;
       
}



I am checking the request with Fiddler and these are the request and the response:


POST https://adwords.google.com/api/adwords/cm/v201809/CampaignService HTTP/1.1
Cache-Control: no-cache, max-age=0
Authorization: Bearer This_is_my_bearer-deP5y1gfvQiiUS4p91rK3RoQdYtQhemYhoRIjZ_ytLQJSwZisC6QxEuhmvtn_vUwhIE_4fLLfJLE4d3PFGFwg
Accept-Encoding: gzip, deflate, gzip, deflate
Request-Id: |302c1af313c1814f8aa71dfcf6376b0b.a9568c1c_4.
Content-Type: text/xml; charset=utf-8
Content-Length: 824
Host: adwords.google.com


<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   
<s:Header>
     
<RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
         
<clientCustomerId>594-834-3247</clientCustomerId>
         <developerToken>this_is_my_token_NDw8W6A</
developerToken>
         
<userAgent>microsoft-socialinsights:ReportDownloader:V3.2 (AwApi-DotNet/24.7.0, Common-Dotnet/9.5.0, .NET CLR/4.0.30319.42000, , gzip)</userAgent>
     
</RequestHeader>
   </
s:Header>
   
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     
<get xmlns="https://adwords.google.com/api/adwords/cm/v201809">
         
<serviceSelector>
           
<fields>Id</fields>
            <fields>Name</
fields>
           
<fields>StartDate</fields>
            <fields>EndDate</
fields>
           
<paging>
               
<startIndex>0</startIndex>
               <numberResults>500</
numberResults>
           
</paging>
         </
serviceSelector>
     
</get>
   </
s:Body>
</s:Envelope>


<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http:/
/schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <ResponseHeader xmlns="
https://adwords.google.com/api/adwords/cm/v201809">
         
<requestId>00058e05935762030a374e58980e9328</requestId>
         <serviceName>CampaignService</
serviceName>
         
<methodName>get</methodName>
         <operations>1</
operations>
         
<responseTime>160</responseTime>
      </
ResponseHeader>
   
</soap:Header>
   <soap:Body>
      <getResponse xmlns="https:/
/adwords.google.com/api/adwords/cm/v201809">
         <rval>
            <totalNumEntries>0</totalNumEntries>
            <Page.Type>CampaignPage</Page.Type>
         </rval>
      </getResponse>
   </soap:Body>
</soap:Envelope>


Any idea what it is wrong?



Thank you in advance,


CCWWManager - Rafael Sánchez>


ccwwmanager

unread,
Jul 24, 2019, 6:35:13 AM7/24/19
to AdWords API and Google Ads API Forum
I answer myself:

The following campaign types are available in the UI but are not currently supported in the API:


Google Ads API Forum Advisor Prod

unread,
Jul 24, 2019, 10:25:31 PM7/24/19
to adwor...@googlegroups.com
Hi,

Yes, what you have mentioned is correct. However, could you confirm if you were able to receive my private message to your email? I sent my response on July 22, 2019. If you are unable to view my response in your inbox, below are its contents :

"Thank you for reaching out and providing complete details about your concern. Upon checking, your 594-834-3247 account only has video campaigns. Currently, video campaigns are supported only in the reports, as mentioned here, and cannot be created, maintained or retrieved using any of the AdWords API's services.

I hope this helps and feel free to write back if you have additional clarifications."


Best regards,
Peter
Google Ads API Team

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