After successfully creating a new AdGroupAd the return value does not seem
to contain all of the information related to that AdGroupAd.
I know that when using the php sdk and calling get on the AdGroupAdService
you need to specify 'policySummary' in the selector in order to get it
returned, however there is no option to specify the return value of a newly
created ad.
here is some example code to illustrate what I mean.
$adGroupAdService = $this->awServices->get($session,
AdGroupAdService::class);
$operation = new AdGroupAdOperation();
$operation->setOperand($ad);
$operation->setOperator('ADD');
$result = $adGroupAdService->mutate($operations);
$adGroupAd = $result->getValue()[0];
// partial value of one of the AdGroupAds in result:
// adGroupId:protected] => <ID>
// [ad:protected] => Google\AdsApi\AdWords\v201710\cm\CallOnlyAd Object
// {ad}
// [status:protected] => ENABLED
// [policySummary:protected] => NULL
$adGroupId = $$adGroupAd->getAdGroupId();
$adId = $adGroupAd->getAd()->getId();
$selector = new Selector();
$selector->setFields(['AdGroupId', 'PolicySummary']);
$selector->setPredicates([
new Predicate('AdGroupId', PredicateOperator::EQUALS, [$adGroupId]),
new Predicate('Id', PredicateOperator::EQUALS, [$adId])
]);
$page = $adGroupAdService->get($selector);
$adGroupAdFull = $page->getEntries()[0];
// partial value of one of the AdGroupAds in result:
// adGroupId:protected] => <ID>
// [ad:protected] => Google\AdsApi\AdWords\v201710\cm\CallOnlyAd Object
// {ad}
// [status:protected] => ENABLED
// [policySummary:protected] =>
Google\AdsApi\AdWords\v201710\cm\AdGroupAdPolicySummary Object
Do I need to make that second call to get policy information or is there a
way it can be returned from the mutate result?
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/deb196e3-1a60-4d3a-98d1-e993ac192e80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.