I have a code base that I'm essentially switching the version of the API 
that's called so I can wrap things up before the sunset date in February:

$campaignService->GetService('CampaignService', 'v201101');

to

$campaignService->GetService('CampaignService', v201109');

The code that follows is identical in both to create the Selector object:

$selector = $campaignService->Create('Selector');

And I go on to set the predicates, date ranges, etc. For v201101, my 
$campaignService->get($selector); returns the expected campaign objects. 
Switching the version ID yields this (serialized for logging):

O:8:"stdClass":1:{s:17:"ApiExceptionFault";O:8:"stdClass":3:{s:7:"message";s:42:"[RequiredError.REQUIRED
 
@ 
serviceSelector]";s:25:"ApplicationException.Type";s:12:"ApiException";s:6:"errors";O:7:"SoapVar":4:{s:8:"enc_type";i:0;s:9:"enc_value";O:33:"GoogleApiAdsAdWords_RequiredError":6:{s:6:"reason";s:8:"REQUIRED";s:9:"fieldPath";s:15:"serviceSelector";s:7:"trigger";s:0:"";s:11:"errorString";s:22:"RequiredError.REQUIRED";s:12:"ApiErrorType";s:13:"RequiredError";s:43:"

I read through the __last_request property of $campaignService and it looks 
like it's not sending anything but <get /> (no fields, predicates, etc.) in 
v201109, but a full request in v201101, so the error is correct. But I have 
no idea what needs to change between the two implementations. I've always 
been able to pass a selector to the ->get() method on the service instance. 
Anything obvious I'm missing?

---

(Snippet simplified for brevity's sake. This method is part of a class that 
extends AdWordsUser)

    /**
     * Get All Campaigns associated with a login
     *
     * @param array $options
     */
    public function GetAllCampaigns( $options = array() ) {

        // Declare service
        $campaignService = $this->GetService('CampaignService', 'v201109');

        // Create selector
        $selector = $campaignService->Create('Selector');
        $selector->fields = array('Id', 'Name', 'Status', 'ServingStatus', 
'StartDate', 'EndDate', 'AdServingOptimizationStatus', 'Settings', 
'Amount', 'Period', 'DeliveryMethod', 'PricingModel', 
'ConversionOptimizerBidType', 'DeduplicationMode', 'EnhancedCpcEnabled', 
'BidCeiling', 'Eligible', 'RejectionReasons', 'Clicks', 'Impressions', 
'Cost', 'AveragePosition', 'AverageCpc', 'AverageCpm', 'Ctr', 
'Conversions', 'ConversionRate', 'CostPerConversion', 
'ConversionsManyPerClick', 'ConversionRateManyPerClick', 
'CostPerConversionManyPerClick', 'ViewThroughConversions', 
'TotalConvValue', 'ValuePerConv', 'ValuePerConvManyPerClick', 
'InvalidClicks', 'InvalidClickRate', 'FrequencyCapMaxImpressions', 
'TimeUnit', 'Level', 'TargetGoogleSearch', 'TargetSearchNetwork', 
'TargetContentNetwork', 'TargetContentContextual', 
'TargetPartnerSearchNetwork');

        $selector->ordering = array($campaignService->Create('OrderBy', 
array('Name', 'ASCENDING') ));

        // Retrieve campaign data
        try {
            $return = $campaignService->get($selector);
            return $return;
        } catch(Exception $e) {
            die ($e->getMessage());
        }
    }

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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

Reply via email to