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.

The code is like the example on Github (
https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201809/BasicOperations/GetCampaigns.cs
). 
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 have checked the request with Fiddler and this is 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 ThisisMyBearer__uhmvtn_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>MyDeveloperToken__EaiBWNDw8W6A</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,


Rafael Sánchez


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/5b9f6f70-c83e-4c51-8bfb-1ef50b0cfaec%40googlegroups.com.

Reply via email to