Re: API Request not Returning Anything

32 views
Skip to first unread message

Stephen Rostanti

unread,
Jan 29, 2021, 12:50:03 PM1/29/21
to AdWords API and Google Ads API Forum
Hello

I am not sure if I am doing something wrong, but when I run my code I get this returned:

CampaignPage {#372 ▼ 
    #entries: null 
    #totalNumEntries: 0 
    #PageType: "CampaignPage
    -parameterMap: array:1 [ 
        "Page.Type" => "PageType
     ] 
}

i.e. no campaigns are returned. My code is as follows:

$oAuth2Credential = (new OAuth2TokenBuilder())
    ->withClientId($clientId)
    ->withClientSecret($clientSecret)
    ->withRefreshToken($refreshToken)
    ->build();

$session = (new AdWordsSessionBuilder())
    ->withDeveloperToken($developerToken)
    ->withClientCustomerId($clientCustomerSecret)
    ->withOAuth2Credential($oAuth2Credential)
    ->build();

$adWordsServices = new AdWordsServices();

$campaignService = $adWordsServices->get($session, CampaignService::class);

$selector = new Selector();
$selector->setFields(array('Id', 'Name'));
$selector->setOrdering(array(new OrderBy('Name', 'ASCENDING')));

$selector->setPaging(new Paging(0, 100));

$page = $campaignService->get($selector);

Then I am just seeing what is the output of $page and that is what I put up top i.e. basically nothing. Does anyone know what could be going wrong here? Any help would be greatly appreciated.

Kind regards

Stephen

Stephen Rostanti

unread,
Feb 1, 2021, 4:29:45 AM2/1/21
to AdWords API and Google Ads API Forum
Does anyone have any suggestions?

Google Ads API Forum Advisor Prod

unread,
Feb 1, 2021, 9:56:15 AM2/1/21
to stephen...@gmail.com, adwor...@googlegroups.com
Hi Stephen,

Please let me know your CID so I can further investigate this issue.

Thanks,
Anthony

Google Logo
Anthony
Google Ads API Team
 


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