Deleting FeedItems from a Feed

381 views
Skip to first unread message

Giles Bodger

unread,
Jul 24, 2014, 5:13:04 AM7/24/14
to adwor...@googlegroups.com
Hi all,

is there any way to delete a Sitelink or indeed ANY FeedItem from a Feed ??

Our integration will potentially want to be removing and adding new Sitelinks VERY frequently as market forces on our business model dictate. I know there is a 250,000 limit on the number of FeedItems associated with an account and believe it or not, this could be within reach if we are not able to actually delete a FeedItem.

I read here - see the post by AdWordsEng-Igor from 12-09-2013 06:21AM - that there is NO way to delete a FeedItem

So if we wanted to change a Sitelink, would we simply change the URL or Text on a specific FeedItem ID as opposed to deleting the old one and adding a new one ?

That would seem logical - BUT is there a way, if we wanted, to delete a sitelink from a feed??

many thanks in advance

Giles

Stacie Waleyko

unread,
Jul 24, 2014, 9:46:05 AM7/24/14
to adwor...@googlegroups.com

Hi Giles,

Have you tried sending a mutate request to FeedItemService with the REMOVE operation? I don't think the API counts REMOVED items towards the limit.

Stacie

Giles Bodger

unread,
Jul 25, 2014, 6:04:57 AM7/25/14
to adwor...@googlegroups.com
Thanks for that Stacie - 

can I presume that any FeedItem that I set to "REMOVE" will then pre present in the next CustomerSyncService's  FeedChangedData object's deletedFeedItems collection ?

many thanks in advance :)

Stacie Waleyko

unread,
Jul 25, 2014, 10:41:39 AM7/25/14
to adwor...@googlegroups.com
No problem. I just tried removing a feed item and making a call to CustomerSyncService. I was surprised to see the feed item id was not in the list of deleted/removed feed items (the response actually didn't even have a list of removedFeedItems). I even tried deleting the campaign feed and it still wasn't returned in the list. If you can't get it to work I recommend making a GET call to FeedItemService to get the status of the feed items. The selector takes a dateRange (but not dateTimeRange like CustomerSyncService). Good luck!

Giles Bodger

unread,
Jul 25, 2014, 10:49:58 AM7/25/14
to adwor...@googlegroups.com
Thanks again for that Stacie - 

I wonder if any of the AdWords Engineers can help on this ?

If there is a limit set on the number of FeedItems on an account then surely there MUST be a way to delete a FeedItem.

Can one of the engineers assist and then explain how in a follow up sync i would see the deletion / removal ?

cheers

Josh Radcliff (AdWords API Team)

unread,
Jul 25, 2014, 11:10:31 AM7/25/14
to adwor...@googlegroups.com
Hi Giles,

Stacie is absolutely correct -- the proper way to delete a FeedItem is to pass it in a REMOVE operation to FeedItemService.mutate. You can also update the FeedItem's attribute values if you prefer that approach, as Stacie mentioned.

Regarding CustomerSyncService, I just tried removing a FeedItem on a test account and a non-test account. On the test account, CustomerSyncService was not returning any FeedChangeData.removedFeedItems, but on the non-test account, CustomerSyncService returned the expected feed item IDs in its FeedChangeData.removedFeedItems.

Stacie - were you trying this out on a test account, by any chance?

One tip: don't forget to specify the feed IDs in your CustomerSyncSelector (I missed that myself the first time!).

Cheers,
Josh, AdWords API Team

Giles Bodger

unread,
Jul 25, 2014, 11:49:08 AM7/25/14
to adwor...@googlegroups.com
Thanks Josh

Stacie Waleyko

unread,
Jul 25, 2014, 1:25:45 PM7/25/14
to adwor...@googlegroups.com
Hi Josh,

I was trying this out on a non-test account. Here is the request and response. I created and deleted the feed today so maybe that explains it? I did play around with the dateTimeRange and tried using a window that would only have the feed item deletion but had no luck. The feed item was removed at 13:57:44 GMT and the requestId from the SOAP response is 0004ff04f52197300a4c12456c007ded. Let me know if you need additional information.

CustomerSyncService Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://adwords.google.com/api/adwords/ch/v201406" xmlns:v201="https://adwords.google.com/api/adwords/cm/v201406">
   <soapenv:Header>
      <v20:RequestHeader>
         <v201:clientCustomerId>848-879-3985</v201:clientCustomerId>
         <v201:developerToken>*****</v201:developerToken>
         <v201:userAgent>*****</v201:userAgent>
         <v201:validateOnly>false</v201:validateOnly>
         <v201:partialFailure>false</v201:partialFailure>
      </v20:RequestHeader>
   </soapenv:Header>
   <soapenv:Body>
      <v20:get>
         <v20:selector>
            <v20:dateTimeRange>
               <v201:min>20140725 000000 UTC</v201:min>
               <v201:max>20140725 235959 UTC</v201:max>
            </v20:dateTimeRange>
            <v20:campaignIds>209752968</v20:campaignIds>
            <v20:feedIds>18907067</v20:feedIds>
         </v20:selector>
      </v20:get>
   </soapenv:Body>
</soapenv:Envelope>

CustomerSyncService Response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <ns2:ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/ch/v201406" xmlns="https://adwords.google.com/api/adwords/cm/v201406">
         <requestId>0004ff07bb17c9f80a42bfa2a60010b4</requestId>
         <serviceName>CustomerSyncService</serviceName>
         <methodName>get</methodName>
         <operations>0</operations>
         <responseTime>223</responseTime>
      </ns2:ResponseHeader>
   </soap:Header>
   <soap:Body>
      <ns2:getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201406" xmlns:ns2="https://adwords.google.com/api/adwords/ch/v201406">
         <ns2:rval>
            <ns2:changedCampaigns>
               <ns2:campaignId>209752968</ns2:campaignId>
               <ns2:campaignChangeStatus>FIELDS_UNCHANGED</ns2:campaignChangeStatus>
               <ns2:removedFeeds>18907067</ns2:removedFeeds>
               <ns2:campaignTargetingChanged>false</ns2:campaignTargetingChanged>
            </ns2:changedCampaigns>
            <ns2:changedFeeds>
               <ns2:feedId>18907067</ns2:feedId>
               <ns2:feedChangeStatus>FIELDS_UNCHANGED</ns2:feedChangeStatus>
            </ns2:changedFeeds>
            <ns2:lastChangeTimestamp>20140725 143508 UTC</ns2:lastChangeTimestamp>
         </ns2:rval>
      </ns2:getResponse>
   </soap:Body>
</soap:Envelope>

When I make a call to FeedItemService to get the feed items I see that one is removed:

FeedItemService Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://adwords.google.com/api/adwords/cm/v201406">
   <soapenv:Header>
      <v20:RequestHeader>
         <v20:clientCustomerId>848-879-3985</v20:clientCustomerId>
         <v20:developerToken>*****</v20:developerToken>
         <v20:userAgent>*****</v20:userAgent>
         <v20:validateOnly>false</v20:validateOnly>
         <v20:partialFailure>true</v20:partialFailure>
      </v20:RequestHeader>
   </soapenv:Header>
   <soapenv:Body>
      <v20:get>
          <v20:selector>
            <v20:fields>FeedItemId</v20:fields>
            <v20:fields>Status</v20:fields>
            <v20:predicates>
               <v20:field>FeedId</v20:field>
               <v20:operator>EQUALS</v20:operator>
               <v20:values>18907067</v20:values>
            </v20:predicates>
            <v20:dateRange>           
               <v20:min>20140725</v20:min>
               <v20:max>20140726</v20:max>
            </v20:dateRange>
         </v20:selector>
      </v20:get>
   </soapenv:Body>
</soapenv:Envelope>

FeedItemService Response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201406">
         <requestId>0004ff051bc4b4300a4c12456c007ded</requestId>
         <serviceName>FeedItemService</serviceName>
         <methodName>get</methodName>
         <operations>0</operations>
         <responseTime>237</responseTime>
      </ResponseHeader>
   </soap:Header>
   <soap:Body>
      <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201406">
         <rval>
            <totalNumEntries>2</totalNumEntries>
            <Page.Type>FeedItemPage</Page.Type>
            <entries>
               <feedId>18907067</feedId>
               <feedItemId>783546139</feedItemId>
               <status>REMOVED</status>
            </entries>
            <entries>
               <feedId>18907067</feedId>
               <feedItemId>783546142</feedItemId>
               <status>ENABLED</status>
            </entries>
         </rval>
      </getResponse>
   </soap:Body>
</soap:Envelope>


Thanks,

Stacie

Josh Radcliff (AdWords API Team)

unread,
Jul 25, 2014, 3:50:19 PM7/25/14
to adwor...@googlegroups.com
Hi Stacie,

I ran some tests for that account and found that the date/time range for the CustomerSyncService request modified the returned values as follows:

(NOTE: The feed item in question was removed @ 2014-07-25 06:57:44 America/Los_Angeles)

1. 20140725 065743 America/Los_Angeles - 20140725 065746 America/Los_Angeles
Returned feed item ID 783546139 in the removedFeedItems collection

2. 20140725 065700 America/Los_Angeles - 20140725 065746 America/Los_Angeles
Same as #1

3. 20140725 065000 America/Los_Angeles - 20140725 065746 America/Los_Angeles
Same as #1

4. 20140725 060000 America/Los_Angeles - 20140725 065746 America/Los_Angeles
Returned
        <ns2:changedFeeds>
          <ns2:feedId>18907067</ns2:feedId>
          <ns2:feedChangeStatus>NEW</ns2:feedChangeStatus>
        </ns2:changedFeeds>
        <ns2:lastChangeTimestamp>20140725 065746 America/Los_Angeles</ns2:lastChangeTimestamp>

The reason the response changed when I went back to 06:00:00 America/Los_Angeles is that now the date/time range of my request encompassed the creation of the Feed and the FeedItem, which occurred at 2014-07-25 06:40:02 America/Los_Angeles, as well as the deletion of FeedItems at 2014-07-25 06:40:39 America/Los_Angeles and 2014-07-25 06:57:44 America/Los_Angeles. Per the docs on FeedChangeData.feedChangeStatus, the value of NEW indicates:

This entity was created during the time frame we're looking at. We will not enumerate all of the individual changes to this entity and its children. Instead it should be loaded from the appropriate service.

In the usual course of operations, you probably won't be creating a feed, creating its feed items, and then deleting its feed items all in the space of a few minutes. I think the more likely use case is that you'll create a feed and its feed items, and then several days/weeks/months later, you'll delete or update some feed items. In the latter use case, the sync service should give you back FeedChangeData.removedFeedItems or FeedChangeData.changedFeedItems if your date range just covers the window where the feed items were deleted or updated.

If you see results that contradict my explanation, please let me know. Thanks for helping out with these questions -- it's great to have others from the community contributing answers!

Best regards,
Josh, AdWords API Team

Stacie Waleyko

unread,
Jul 28, 2014, 2:02:20 PM7/28/14
to adwor...@googlegroups.com
Hi Josh, 

Glad to see the service is working as expected. I didn't realize CustomerSyncService was that precise! I agree this probably isn't your typical use case though. Thank you for such a detailed response!

Stacie

Giles Bodger

unread,
Mar 1, 2016, 10:59:29 AM3/1/16
to AdWords API Forum
Hi guys - 

I posted this question originally about 18 months ago - 

So 18 months later, i find that a few of our accounts are actually near the account limit of 400,000 feed items. In fact i am currently looking at one Feed that has 400,034 feed items in it.

When we add sitelinks to our campaigns we use the FeedItemService and the "Remove" operation to remove the currently associated Feed Items, and then add a new ones. We do this VERY regularly as our links can change many times a day


We are now getting errors on trying to add new feed items

"EntityCountLimitExceeded.ACCOUNT_LIMIT"

And like i said, i can navigate to the Shared Library for the particular account and can see that for the Sitelink feed we are indeed over the 400k number


So what would be the advice on how to now add sitelinks to campaigns in this account - Is there a way to actually delete FeedItems from a feed that isnt just using the "Remove" operation - It would appear that removed items still count towards your entity limit


cheers in advance

Giles

Josh Radcliff (AdWords API Team)

unread,
Mar 1, 2016, 1:47:52 PM3/1/16
to AdWords API Forum
Hi Giles,

Could you share your AdWords client customer ID (or even just the Feed ID)? The approach you described sounds correct to me, so I want to take a closer look.

Thanks,
Josh, AdWords API Team

Giles Bodger

unread,
Mar 1, 2016, 5:20:56 PM3/1/16
to AdWords API Forum
HI Josh - the feedId in question is 1579261 

- cheers

Josh Radcliff (AdWords API Team)

unread,
Mar 1, 2016, 6:24:28 PM3/1/16
to AdWords API Forum
Hi Giles,

Thanks for the ID. I took a look, and from what I can tell, the 400,000+ feed items all have status ENABLED. I also confirmed this by performing a FeedItemService.query for that ID + Status = ENABLED, which returned totalNumEntries = 400034.

When you are performing your REMOVE operations, are you using FeedItemService.mutate or CampaignFeedMappingService.mutate/AdGroupFeedMappingService.mutate? If the latter, then the only thing you are removing is the association between the feed items and the campaign/ad group. The feed items themselves will still remain ENABLED, and therefore will count towards the account limit.

Thanks,
Josh, AdWords API Team

Giles Bodger

unread,
Mar 8, 2016, 4:27:27 AM3/8/16
to AdWords API Forum
Hey Josh - 

You were right, i had thought we were REMOVEing all out feed items as we disassociated the feed items from the campaigns, but turns out we weren't! - So we will now make amends, thanks for you help here

cheers

Giles
Reply all
Reply to author
Forward
0 new messages