Hi Aryeh,

Thank you for the information. I have followed the same documentation. But 
getting the same error

1. Create ImageAsset for ImageExtension

// Creates an asset.
$asset = new Asset([
'type' => AssetType::IMAGE,
'image_asset' => new ImageAsset(['data' => $imageContent])
]);

// Creates an asset operation.
$assetOperation = new AssetOperation();
$assetOperation->setCreate($asset);

// Issues a mutate request to add the asset.
$assetServiceClient = $this->googleAdsClientSession->getAssetServiceClient
();
$response = $assetServiceClient->mutateAssets(
$clientId,
[$assetOperation]
);
if (!empty($response->getResults())) {
$addedImageAsset = $response->getResults()[0];
return $addedImageAsset->getResourceName();
}

2. Add asset to AdGroup

Shirly J
22 Nov 2021, 09:42:36 (yesterday) 
to AdWords API and Google Ads API Forum
Hi,

I am trying to do the same(adding image extension to adgroup).

//adgroupassetOperation
$adGroupAssetOperation = new AdGroupAssetOperation([
'create' => new AdGroupAsset([
'asset' => $imageAssetResourceName,
'field_type' => AssetFieldType::MARKETING_IMAGE,
'ad_group' => ResourceNames::forAdGroup($clientId, $adGroupId)
])
]);

$adGroupAssetServiceClient = $this->googleAdsClientSession->
getAdGroupAssetServiceClient();
$response = $adGroupAssetServiceClient->mutateAdGroupAssets($clientId, [
$adGroupAssetOperation]);

Could you please point out what is missing?

Thanks
On Monday, 22 November 2021 at 20:46:38 UTC adsapi wrote:

> Hi Shirley,
>
> Please note that the CampaignAsset, AdGroupAsset and CustomerAsset works 
> only for assets that are associated with an Extension 
> <https://developers.google.com/google-ads/api/docs/extensions/assets/asset-extensions#php>
> .
>
> Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 
> 2021 
> Google Ads API and AdWords API Annual Survey 
> <https://google.qualtrics.com/jfe/form/SV_eQbOpf4VxRyyqqO?source=so>
>  
> Regards, 
> [image: Google Logo] 
> Aryeh Baker 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2QGllD:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/da819fe5-25c3-494f-9b7c-fc1059092a41n%40googlegroups.com.
  • as... Shawn Naquin
    • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum
      • ... Shirly J
        • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum
          • ... Shirly J
          • ... Shirly J
            • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum
              • ... Algirdas Jarockis
                • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum

Reply via email to