hi guys, I am currently working on using V13 of the API in order to upload
image extensions and link them at a campaign and/or adgroup level. The
example code in the SDK currently is showing the soon to be deprecated
method which involves creating a feed item etc in order to do this. I am
wanting to achieve this using Assets and linking the asset to an entity at
the required level. Currently my code is attempting to upload the asset as
an image, and then attepting to link that asset to a given level. I seem to
be able to upload the asset to google ads system as I am getting a resource
id returned. After this I am attempting to link the asset, which has the
asset type of "IMAGE", into a campaign/ad group. The issue here is that
there are several seemingly relevant AssetFieldType values available, but I
have tried each of these (MARKETING_IMAGE, AD_IMAGE,
SQUARE_MARKETING_IMAGE), and they are all returning the same error at the
point of trying to link: ``` Fault ------- Status code: 3 Failure:
{"errors":[{"errorCode":{"assetLinkError":"UNSUPPORTED_FIELD_TYPE"},"message":"The
given field type is not supported to be added directly through asset
links.","trigger":{"stringValue":"MARKETING_IMAGE"},"location":{"fieldPathElements":[{"fieldName":"operations","index":0},{"fieldName":"create"},{"fieldName":"field_type"}]}}],"requestId":"M35CAIZIoeepuJh1RKVKaw"}
[] Log Level: NOTICE ``` My current code looks something like: <?php
require "vendor/autoload.php"; use
Google\Ads\GoogleAds\V13\Common\ImageAsset; use
Google\Ads\GoogleAds\V13\Enums\AssetFieldTypeEnum\AssetFieldType; use
Google\Ads\GoogleAds\V13\Resources\Asset; $googleAdsClient = new
GoogleClient(); $customerId = "123456789"; $adGroupId = "123456789"; $asset
= new Asset([ "name" => $asset['name'], "image_asset" => new
ImageAsset(['data' => file_get_contents($asset['url'])]), ]); // upload
asset, returns asset resource name eg: // $assetResourceName =
"example/1234/example/1234"; $imageExtensionAdGroupAssetOperations = [ new
AdGroupAssetOperation([ "create" => new AdGroupAsset([ "asset" =>
$assetResourceName, "ad_group" => ResourceNames::forAdGroup(
$runningJob->getCustomerId(), $adGroupId ), "field_type" =>
AssetFieldType::MARKETING_IMAGE, ])]) ]; $adGroupAssetServiceClient =
$googleAdsClient->getAdGroupAssetServiceClient(); $response =
$adGroupAssetServiceClient->mutateAdGroupAssets( $customerId,
$imageExtensionAdGroupAssetOperations ); is there any documentation
available on what the differences between all of these different
AssetFieldType values actually relate to (MARKETING_IMAGE, AD_IMAGE,
SQUARE_MARKETING_IMAGE) and why they are not compatible with an IMAGE type
asset? is this expected behavior? It seems like there is no way forward
that I can see in order to properly link an image asset to any of these
asset field types. Or is there some part which I am getting wrong along the
way? thanks in advance for clarifying
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/70b7c4b4-5385-4cd1-8ece-da37dfe90d94n%40googlegroups.com.