Martialdelastic / google-api-adwords-php

Automatically exported from code.google.com/p/google-api-adwords-php
Apache License 2.0
0 stars 0 forks source link

AdsSoapClient.php selects the wrong API version #95

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Which version of the library are you using?
4.2.5

Which version of PHP are you using?
PHP 5.3.10-1ubuntu3.6

What steps will reproduce the problem?
create a keyword in a fresh adgroup in a fresh campaign

What is the expected output? What do you see instead?
I get the following call stack:

PHP Notice:  Undefined index: biddingStrategyConfiguration in 
/home/jeti/workspace/NeuAdos/vendor/google/adwords/src/Google/Api/Ads/AdWords/v2
01209/MutateJobService.php on line 627
PHP Stack trace:
PHP   1. {main}() /home/jeti/workspace/NeuAdos/cron:0
PHP   2. include() /home/jeti/workspace/NeuAdos/cron:5
PHP   3. Casadatos\Adwords\Controller->run() 
/home/jeti/workspace/NeuAdos/cron.php:36
PHP   4. Casadatos\Adwords\CmKeywordManager->createKeywords() 
/home/jeti/workspace/NeuAdos/lib/Casadatos/Adwords/Controller.php:86
PHP   5. Casadatos\Adwords\CmKeywordManager->doPortion() 
/home/jeti/workspace/NeuAdos/lib/Casadatos/Adwords/CmKeywordManager.php:331
PHP   6. AdGroupCriterionService->mutate() 
/home/jeti/workspace/NeuAdos/lib/Casadatos/Adwords/CmKeywordManager.php:369
PHP   7. AdsSoapClient->__soapCall() 
/home/jeti/workspace/NeuAdos/vendor/google/adwords/src/Google/Api/Ads/AdWords/v2
01302/AdGroupCriterionService.php:7081
PHP   8. SoapClient->__soapCall() 
/home/jeti/workspace/NeuAdos/vendor/google/adwords/src/Google/Api/Ads/Common/Lib
/AdsSoapClient.php:200
PHP   9. AdGroupCriterion->__set() 
/home/jeti/workspace/NeuAdos/vendor/google/adwords/src/Google/Api/Ads/AdWords/v2
01209/MutateJobService.php:0

I would expect, that in line 9 a method from v201302 is chosen instead of 
v201209. Line 7 shows, that the application sets the version correctly.
(This error crashes the application in the end)

Please provide any additional information below.

Original issue reported on code.google.com by thomas2....@googlemail.com on 15 May 2013 at 9:19

GoogleCodeExporter commented 8 years ago
Hi Thomas,

Can you give me an example of the structure you're passing into the mutate 
method on the AdGroupCriterionService?

Please remember to anonymise any personally identifiable information, such user 
ids and passwords.

Regards,

- Paul, AdWords API Team. 

Original comment by api.pmat...@gmail.com on 15 May 2013 at 2:20

GoogleCodeExporter commented 8 years ago
Hi Paul,

I build the structure with the following code:

define('ADWORDS_VERSION', 'v201302');
$adGroupCriterionService = $this->user->GetService('AdGroupCriterionService',  
ADWORDS_VERSION, NULL, NULL, NULL, TRUE);
$keyword = new Keyword();
$keyword->text = $keywordLocalizer . ' ' . $objectType; //strings
$keyword->matchType = 'EXACT';
if ($isNegative) {
    $adGroupCriterion = new NegativeAdGroupCriterion();
    $criterionUse = 'NEGATIVE';
} else {
    $adGroupCriterion = new BiddableAdGroupCriterion();
    $criterionUse = 'BIDDABLE';
}
$adGroupCriterion->adGroupId = $adGroupId;
$adGroupCriterion->criterion = $keyword;
$operation = new AdGroupCriterionOperation();
$operation->operand = $adGroupCriterion;
$operation->operator = 'ADD';
$operations[] = $operation;
$result = $adGroupCriterionService->mutate($operations);

The error already occurs with an oparations array with a single field.

Regards
Thomas

Original comment by thomas2....@googlemail.com on 15 May 2013 at 2:44

GoogleCodeExporter commented 8 years ago
one addition:

the following code belonged to the affiliated adgroup

$bids = new ManualCPCAdGroupBids();
$bids->keywordMaxCpc = new Bid(new Money(10000));
$bids->keywordContentMaxCpc = new Bid(new Money(20000));
$adGroup->bids = $bids;

When I delete this snippet the above code works. But I think, the API should 
have thrown an error or an exception at this point.

Original comment by thomas2....@googlemail.com on 6 Jun 2013 at 12:22

GoogleCodeExporter commented 8 years ago
Can you confirm that this problem still exists with version 4.5.0 or newer of 
the AdWords API PHP Client Library?

Regards,

- Paul, AdWords API Team.

Original comment by api.pmat...@gmail.com on 31 Jul 2013 at 4:28

GoogleCodeExporter commented 8 years ago
With version 4.5.0 this error doesn't exist anymoure.
Regards
Thomas

Original comment by thomas2....@googlemail.com on 31 Jul 2013 at 11:36

GoogleCodeExporter commented 8 years ago
Thanks for clarifying this Thomas.

Regards,

- Paul, AdWords API Team.

Original comment by api.pmat...@gmail.com on 5 Aug 2013 at 1:13