No Results for Campaign Service

78 views
Skip to first unread message

RCV

unread,
Sep 19, 2016, 4:49:44 AM9/19/16
to AdWords API Forum
Hi,

I'm using the experimental Branch. When I try to get all campaigns i get 0 results but I have campaigns on my test account. My code is as following:

------------------------------------------------------------------------------------------

$oAuth2Credential = (new OAuth2TokenBuilder())
            ->fromFile(drupal_get_path('module', 'rcv_api') . '/extras/adsapi_php.ini')
            ->build();

        $session = (new AdWordsSessionBuilder())
            ->fromFile(drupal_get_path('module', 'rcv_api') . '/extras/adsapi_php.ini')
            ->withOAuth2Credential($oAuth2Credential)
            ->build();
       
        //

        $adWordsServices = new AdWordsServices();
        $campaignService = $adWordsServices->get($session, 'CampaignService', 'v201605', 'cm');
       
       

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

        // Create paging controls.
        $selector->setPaging(new Paging(0, 100));

        // Make the get request.
        $page = $campaignService->get($selector);

------------------------------------------------------------------------------------------

Here are my campaigns:



------------------------------------------------------------------------------------------

I tried to debug some and i found on the page dump the following information about request:

["location"]=>
  string(70) "https://adwords.google.com/api/adwords/cm/v201605/CampaignService?wsdl"
  ["__last_request"]=>
  string(934) "<?xml version="1.0" encoding="UTF-8"?>
************************ (AwApi-PHP, googleads-php-lib/1.3.1-beta, PHP/7.0.4)falsefalseIdNameNameASCENDING0100
"
  ["httpsocket"]=>
  resource(587) of type (stream)
  ["_use_proxy"]=>
  int(0)
  ["httpurl"]=>
  resource(588) of type (SOAP URL)
  ["__last_request_headers"]=>
  string(312) "POST /api/adwords/cm/v201605/CampaignService?wsdl HTTP/1.1
Host: adwords.google.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/7.0.4
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 934
Authorization: ************************

"
  ["__last_response_headers"]=>
  string(364) "HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Mon, 19 Sep 2016 07:27:42 GMT
Expires: Mon, 19 Sep 2016 07:27:42 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: clear
Accept-Ranges: none
Vary: Accept-Encoding
Transfer-Encoding: chunked
"
  ["__last_response"]=>
  string(578) "<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201605"><requestId>************************</requestId><serviceName>CampaignService</serviceName><methodName>get</methodName><operations>1</operations><responseTime>82</responseTime></ResponseHeader></soap:Header><soap:Body><getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201605"><rval><totalNumEntries>0</totalNumEntries><Page.Type>CampaignPage</Page.Type></rval></getResponse></soap:Body></soap:Envelope>"
}
Can anyone help? Thank you

Peter Oliquino

unread,
Sep 19, 2016, 5:16:22 AM9/19/16
to AdWords API Forum
Hi,

I could see based on your screenshot that your campaigns are video campaigns. Unfortunately, video campaigns are currently not supported in the services of the AdWords API. Video campaigns information however, can be viewed via the AdWords UI and the reports in the AdWords API. In your case, you may use the Campaign Performance Report and filter using the AdvertisingChannelType field. I hope this helps.

Best regards,
Peter
AdWords API Team

RCV

unread,
Sep 19, 2016, 5:21:31 AM9/19/16
to AdWords API Forum
Thank you very mach for your fast response :)

RCV

unread,
Sep 19, 2016, 7:44:59 AM9/19/16
to AdWords API Forum
Hi,

i'm trying to get success with downloading a report but im confused on the documents because im using namespaced dev experimental branch of api.
My code is the following:


-------------------------------------------------------------------
$oAuth2Credential = (new OAuth2TokenBuilder())
            ->fromFile(drupal_get_path('module', 'rcv_api') . '/extras/adsapi_php.ini')
            ->build();

        $session = (new AdWordsSessionBuilder())
            ->fromFile(drupal_get_path('module', 'rcv_api') . '/extras/adsapi_php.ini')
            ->withOAuth2Credential($oAuth2Credential)
            ->build();
       
        // Create selector.
        $selector = new Selector();
        $selector->setFields(array('AdGroupName'));
        $selector->setOrdering(array(new OrderBy('AdGroupName', 'ASCENDING')));
       
        //Create Report Defnition
        $reportDefinition = new ReportDefinition();
        $reportDefinition->selector = $selector;
        $reportDefinition->reportName = 'Video performance report #' . uniqid();
        $reportDefinition->dateRangeType = 'LAST_7_DAYS';
        $reportDefinition->reportType = 'VIDEO_PERFORMANCE_REPORT';
        $reportDefinition->downloadFormat = 'CSV';
       
        $reportDownloader = new ReportDownloader();
        $reportDownloader->session = $session;
        $report = $reportDownloader->downloadReport($reportDefinition, $filePath);
-------------------------------------------------------------------

I got: "Cannot access private property Google\AdsApi\AdWords\Reporting\v201605\ReportDefinition::$selector"

I'm sure i'm not doing the thing right. Can you help me? Thank you,

Peter Oliquino

unread,
Sep 19, 2016, 11:28:57 PM9/19/16
to AdWords API Forum
Hi,

You may want to try out our example in the client library instead. Also, you may find our reporting guide helpful in generating your reports. 

RCV

unread,
Sep 20, 2016, 3:20:29 AM9/20/16
to AdWords API Forum
Thank Peter,

I've installed new dev release and all is fine. I'm using it on Drupal 8 and works like a charm. Great job!
Reply all
Reply to author
Forward
0 new messages