update and remove sitelink asset ads php

56 views
Skip to first unread message

Turkmeks DEV

unread,
Jan 31, 2023, 5:56:26 AM1/31/23
to Google Ads API and AdWords API Forum
when ı updated site links  give me error like this

Request Id : a96meqnkqlLnHykRjHVvbw mutate_error Error Code  Resource was not found.
 how can ı update sitelink asset and remove site links

my code :

          // Creates an extension feed item using the specified feed item ID and sitelink text.
        $extensionFeedItem = new ExtensionFeedItem([
            'resource_name' => ResourceNames::forExtensionFeedItem($customerId, $feedItemId),
            'sitelink_feed_item' => new SitelinkFeedItem(['link_text' => $sitelinkText])
        ]);

        // Constructs an operation that will update the extension feed item, using the FieldMasks
        // utility to derive the update mask. This mask tells the Google Ads API which attributes of
        // the extension feed item you want to change.
        $extensionFeedItemOperation = new ExtensionFeedItemOperation();
        $extensionFeedItemOperation->setUpdate($extensionFeedItem);
        $extensionFeedItemOperation->setUpdateMask(FieldMasks::allSetFieldsOf($extensionFeedItem));

        // Issues a mutate request to update the extension feed item.
        $extensionFeedItemServiceClient = $googleAdsClient->getExtensionFeedItemServiceClient();
        $response = $extensionFeedItemServiceClient->mutateExtensionFeedItems(
            $customerId,
            [$extensionFeedItemOperation]
        );

        // Prints the resource name of the updated extension feed item.
        /** @var ExtensionFeedItem $updatedExtensionFeedItem */
        $updatedExtensionFeedItem = $response->getResults()[0];
        printf(
            "Updated extension feed item with resource name: '%s'.%s",
            $updatedExtensionFeedItem->getResourceName(),
            PHP_EOL
        );

Google Ads API Forum Advisor

unread,
Jan 31, 2023, 11:50:18 AM1/31/23
to devtu...@gmail.com, adwor...@googlegroups.com
Hi,

Thanks for reaching out to the Google Ads API Forum.

I can see that your concern has also been raised in another email with the subject “google ads php- update sitelink asset from campaign”.

Please refrain from opening duplicate threads with the same content for better tracking of the issue.

Regards,
Google Logo
Abigail
Google Ads API Team
 


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