Google API Price extension - corrupted data (CampaignId, microAmount, feedItemId, feedMappingId)

39 views
Skip to first unread message

Alexander Popov

unread,
Nov 30, 2017, 4:57:24 PM11/30/17
to AdWords API Forum
Hi.
We Use PHP and I was following examples: https://developers.google.com/adwords/api/docs/guides/extension-settings#update_ad_extensions and everything works fine if i run code in browser like http://mysite.com/myfile.php so code is inside "myfile.php" file

But if I run using cron, I get:
exception 'Google\AdsApi\AdWords\v201710\cm\ApiException' with message
'[EntityNotFound.INVALID_ID @ operations[0].operand.campaignId;
trigger:'CampaignId: 94408149']' in /PATH/TO/LIBRARY/lib/Google/src/Google/AdsApi/Common/Util/Reflection.php:39

SOAP:
AW_SOAP.WARNING: clientCustomerId=MY-ID operations=3 service=CampaignExtensionSettingService method=mutate responseTime=160 requestId=00055f3907c35e200a3f3b12820373fb server=adwords.google.com isFault=1 faultMessage=[EntityNotFound.INVALID_ID @ operations[0].operand.campaignId; trigger:'CampaignId: 94408149']

part of code we use:
$campaignId = "944081497";
$campaignExtensionSettingService = $adWordsServices->get($session, CampaignExtensionSettingService::class);

$selector = new Selector();
$selector->setFields(['CampaignId', 'ExtensionType', 'Extensions']);
$selector->setPredicates([
    new Predicate('CampaignId', PredicateOperator::EQUALS,
        [$campaignId]),
    new Predicate('ExtensionType', PredicateOperator::EQUALS,
        [FeedType::PRICE])
]);

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

$campaignExtensionSetting = $page->getEntries()[0];
$campaignExtensionSetting->setExtensionType(FeedType::PRICE);


If I debug $campaignExtensionSetting->getCampaignId(); - I get corrupted value ”@ I (get 944081497 if run in http://mysite.com/myfile.php)

Again if I run http://mysite.com/myfile.php I get 944081497 which is right. So in error above you see "94408149" which is missing 7 in the end and that's why doesn't work.
I've tried intval() to floatval() as suggested here https://groups.google.com/forum/#!topic/adwords-api/NEjJg_7GXQw but it doesn't help..
What can be a reason that Google returns corrupted ID?

I noticed that other data is corrupted:

Google\AdsApi\AdWords\v201710\cm\CampaignExtensionSetting::__set_state(array(
   'campaignId' => '”@ I',
   'extensionType' => 'PRICE',
   ....

Google\AdsApi\AdWords\v201710\cm\Money::__set_state(array(
                 'microAmount' => ' 4p' . "\0" . '',

'feedId' => '9 …U',
         'feedItemId' => ' V…xf',
         'policyData' =>
        array (
          0 =>
          Google\AdsApi\AdWords\v201710\cm\FeedItemPolicyData::__set_state(array(
             'placeholderType' => 35,
             'feedMappingId' => 'B s',
             ......

so microAmount, feedId, feedItemId, feedMappingId are wrong too

running http://mysite.com/myfile.php - all is good

please assist

Peter Oliquino

unread,
Dec 1, 2017, 1:47:52 AM12/1/17
to AdWords API Forum
Hi Alexander,

In order to better investigate your concern, could you provide the complete SOAP request and response that was generated when you encountered the error? You may reply using the Reply privately to author option.

Thanks and regards,
Peter
AdWords API Team

Alexander Popov

unread,
Dec 1, 2017, 3:25:02 PM12/1/17
to AdWords API Forum
hi Peter. sent reply using "Reply privately to author" thanks

Alexander Popov

unread,
Dec 7, 2017, 10:27:56 AM12/7/17
to AdWords API Forum
We could fix it. The problem was that v201710 worked for us only on php5.6 running on admin server via cron was failed as we had php5.4 on admin. Updating admin server to 5.6 fixed the issue. thanks
Reply all
Reply to author
Forward
0 new messages