No campaigns were found

59 views
Skip to first unread message

kyungj...@quantumpirates.com

unread,
Apr 11, 2019, 6:35:29 AM4/11/19
to AdWords API and Google Ads API Forum
language: java 1.8
IDE: eclipse
using Google Cloud Platform App Engine

I want get all campaigns in my account, so I tried com.google.api.ads.adwords.axis.v201809.cm.CampainServiceInterface's get() method.
But I received "No campaigns were found", even I had campaigns.

Moreover, when I use com.google.api.ads.adwords.axis.v201809.cm.ReportDefinitionServiceInterface's getReportFields() method, it brings me correct response.

Please solve this problem.

Under this section, I upload my codes.







AdWordsSession session = null;

CreateAdWordsSessionWithoutPropertiesFile createAdWordsSessionWithoutPropertiesFile = new CreateAdWordsSessionWithoutPropertiesFile();

try {

session = createAdWordsSessionWithoutPropertiesFile.createAdWordsSession();

} catch (OAuthException | ValidationException e2) {

e2.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

AdWordsServicesInterface adWordsServices = AdWordsServices.getInstance();

CampaignServiceInterface campaignService = adWordsServices.get(session, CampaignServiceInterface.class);

System.out.println(campaignService.toString());

    int offset = 0;


    // Create selector.

    SelectorBuilder builder = new SelectorBuilder();

    Selector selector = builder

        .fields(CampaignField.Id, CampaignField.Name)

        .orderAscBy(CampaignField.Name)

        .offset(offset)

        .limit(100)

        .build();

   

    CampaignPage page;

    do {

      // Get all campaigns.

      page = campaignService.get(selector);

     

      if(page == null) {

      System.out.println("page is null");

      }

     

      System.out.println(page.getPageType());

      System.out.println(page.toString());

     


      // Display campaigns.

      if (page.getEntries() != null) {

        for (Campaign campaign : page.getEntries()) {

          System.out.printf("Campaign with name '%s' and ID %d was found.%n", campaign.getName(), campaign.getId());

        }

      } else {

        System.out.println("No campaigns were found.");

      }


      offset += 100;

      selector = builder.increaseOffsetBy(100).build();

    } while (offset < page.getTotalNumEntries());



googleadsapi...@google.com

unread,
Apr 11, 2019, 10:26:57 AM4/11/19
to kyungj...@quantumpirates.com, AdWords API and Google Ads API Forum
Hello, 

Could you please share the API SOAP logs for the CampaignService.get() operation to check this further? You can share the logs privately via Reply privately to author option.

Regards,
Bharani, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

kyungj...@quantumpirates.com

unread,
Apr 11, 2019, 9:38:06 PM4/11/19
to AdWords API and Google Ads API Forum
How can I get an API SOAP logs..?

2019년 4월 11일 목요일 오후 7시 35분 29초 UTC+9, kyung...@quantumpirates.com 님의 말:

googleadsapi...@google.com

unread,
Apr 12, 2019, 11:39:40 AM4/12/19
to kyungj...@quantumpirates.com, AdWords API and Google Ads API Forum
Hello, 

You may refer to this guide for steps to enable logging for the Java client library. You can reply back via Reply privately to author option.

Thanks,
Bharani, Google Ads API Team

kyungj...@quantumpirates.com

unread,
Apr 15, 2019, 1:25:55 AM4/15/19
to AdWords API and Google Ads API Forum
I can find SLF4J logger. However, I can't find how to use this logger. I never used this logger before. Please let me know how to use this logger, not just guide in git-hub..

2019년 4월 13일 토요일 오전 12시 39분 40초 UTC+9, googleadsapi-forumadvisor 님의 말:

googleadsapi...@google.com

unread,
Apr 15, 2019, 1:41:12 PM4/15/19
to kyungj...@quantumpirates.com, AdWords API and Google Ads API Forum
Hello, 

If you're using the client libraries, using the log4j with the project as mentioned here will be helpful.  The SOAP loggers in this guide also will help you with this. Could you please give this a try? Please share the details privately via Reply privately to author option.

Thanks,
Bharani, Google Ads API Team
Reply all
Reply to author
Forward
0 new messages