Getting products from a specific datafeed

40 views
Skip to first unread message

Luuk Fiets

unread,
Oct 13, 2020, 6:37:25 AM10/13/20
to Google Apps Script Community
Hi,

I'm using the ShoppingContent service to list all products in a merchant center. The problem I'm facing is that it lists products for all feeds, but I only need my script to list products from one specific feed.

Are there any options to specify which datafeed to use when listing products?

Regards,
Luuk

Alan Wells

unread,
Oct 13, 2020, 10:38:02 AM10/13/20
to Google Apps Script Community
I'm assuming that you are using the datafeeds.list method of the Shopping API


The datafeeds.list method returns an array of objects, each object is for a separate feed ID.
You'd need to loop through the array, get the inner object, then get the ID property and test it against your
required feed ID to get the feed that you want.

Your other option is to use the datafeeds.custombatch method,
which has a stated intent of:
Quote:
Deletes, fetches, gets, inserts and updates multiple datafeeds in a single request.
End Quote:


However, I'm wondering if you only enter one feed ID in the Batch resource that it could work as a query
to just return one feed.
I don't know if it's worth going through the trouble to figure out how to configure that request,
rather than just getting all feeds, and looping through them.

luuk...@happyidiots.nl

unread,
Oct 14, 2020, 3:21:30 AM10/14/20
to Google Apps Script Community
Hi,

Thanks for helping out! I'm actually using the products.list method. It lists all products in the Merchant Center, but what I'd like to do is give it some kind of condition.

We have seperate datafeeds for Shopping in the Netherlands and Shopping in Belgium. When listing the products I'm getting the same ID twice, because it is in both feeds. What I'd actually like to do, is first "select" (make a condition for) the Dutch shopping feed and only list those products.

Problem is that I don't see any options to pass a parameter of which datafeed you'd like to use when listing products: https://developers.google.com/shopping-content/reference/rest/v2.1/products/list.

Op dinsdag 13 oktober 2020 om 16:38:02 UTC+2 schreef aj.a...@gmail.com:

Alan Wells

unread,
Oct 14, 2020, 9:12:44 AM10/14/20
to Google Apps Script Community
The only way that I see to designate a data feed ID is with:
datafeeds.get
I'm not familiar with the Shopping API, so I'm just reading the documentation
and guessing.
I don't have the best answer.

Reply all
Reply to author
Forward
0 new messages