Cannot update AdGroupAd using GoogleAds API

110 views
Skip to first unread message

integrations bidalgo

unread,
Aug 22, 2019, 3:38:13 AM8/22/19
to AdWords API and Google Ads API Forum
Hi,

I’m trying to update texts for an AdgroupAd using the following code (using GoogleAds API):

{
$appAdInfo = new AppAdInfo();
$headlinesAssets = $this->stringArrayToAdAssetTextArray(['Head', 'Head2']);
$appAdInfo->setHeadlines($headlinesAssets);
$descriptionsAssets = $this->stringArrayToAdAssetTextArray(['Decs1']);
$appAdInfo->setDescriptions($descriptionsAssets);

$appAd = new Ad(['app_ad' => $appAdInfo]);
// Creates an ad group ad to hold the above ad.
$adGroupResourceName = new StringValue(['value' => ResourceNames::forAdGroup($this->account_google_id,XXXXXXX)]);
$adGroupAd = new AdGroupAd([
'ad_group' => $adGroupResourceName,
'ad' => $appAd
]);

$adGroupAdOperation = new AdGroupAdOperation();
$adGroupAdOperation->setUpdate($adGroupAd);
$adGroupAdOperation->setUpdateMask(FieldMasks::allSetFieldsOf($adGroupAd));
$operations[] = $adGroupAdOperation;

return $this->adGroupAdServiceClient->mutateAdGroupAds($this->account_google_id, $operations);
}

Getting error: "Request contains an invalid argument.
Error log:
Method Name: /google.ads.googleads.v2.services.AdGroupAdService/MutateAdGroupAds
Host: googleads.googleapis.com
Headers: {
"x-goog-api-client": "gl-php\/7.1.23 gapic\/ gax\/1.0.3 grpc\/1.20.0",
"x-goog-request-params": "customer_id=2944805093",
"developer-token": "REDACTED",
"login-customer-id": "6330691878"
}
Request: {"customerId":"2944805093","operations":[{"updateMask":"adGroup,ad.resourceName,ad.id,ad.finalUrls,ad.finalAppUrls,ad.finalMobileUrls,ad.trackingUrlTemplate,ad.urlCustomParameters,ad.displayUrl,ad.type,ad.addedByGoogleAds,ad.devicePreference,ad.urlCollections,ad.name,ad.systemManagedResourceSource,ad.textAd,ad.expandedTextAd,ad.callOnlyAd,ad.expandedDynamicSearchAd,ad.hotelAd,ad.shoppingSmartAd,ad.shoppingProductAd,ad.gmailAd,ad.imageAd,ad.videoAd,ad.responsiveSearchAd,ad.legacyResponsiveDisplayAd,ad.appAd.mandatoryAdText,ad.appAd.headlines,ad.appAd.descriptions,ad.appAd.images,ad.appAd.youtubeVideos,ad.appAd.html5MediaBundles,ad.legacyAppInstallAd,ad.responsiveDisplayAd,ad.displayUploadAd,ad.appEngagementAd,ad.shoppingComparisonListingAd","update":{"adGroup":"customers\/2944805093\/adGroups\/76171208785","ad":{"appAd":{"headlines":[{"text":"Head"},{"text":"Head2"}],"descriptions":[{"text":"Decs1"}]}}}}]}

Response
-------
Headers: {
"request-id": "UiFATkF14S65Okv7gIbq6w",
"date": "Thu, 22 Aug 2019 07:32:51 GMT",
"alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43,39\""
}

Fault
-------
Status code: 3
Details: Request contains an invalid argument.
Failure: {}
Please advise.

Google Ads API Forum Advisor Prod

unread,
Aug 22, 2019, 1:37:29 PM8/22/19
to integr...@bidalgo.ai, adwor...@googlegroups.com
Hi, 

It is not possible to mutate Ad Group Ads using AdGroupAdService. You will need to use AdService for updating existing ads that were created using AdGroupAdService. Could you please give this a try with AdService and let me know if you encounter any issues?

Regards,
Bharani, Google Ads API Team

ref:_00D1U1174p._5001UHELIs:ref
Reply all
Reply to author
Forward
0 new messages