Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting all listing images from an Etsy shop

Tags:

api

etsy

THE SITUATION

I've been tooling around in the Etsy sandbox API trying to figure out a solution for a client who wants to show the default image and title to all their Etsy listings. Upon clicking, they want it to direct them off the website and onto that Esty listing's page.

Now, figuring out how to get the name and url of all their listings was easy and can be done in one public API call:

http://openapi.etsy.com/v2/shops/:shop_id/listings/active?method=GET&api_key=:api_key

This call will not only return the name of the listing and the url of listing, but also a multitude of other information on that particular item. I suppose I should limit my call to just getting the fields I need, but for sake of example, I digress...

What surprises me most is that what is not included in that gigantic array of information is something I'd expect to find in there: the images associated with the listing or at least the main image. There is however a separate API call I can make to get the images for a single listing, but that would require getting the listing_id and making a separate API call for each item. This now turns what I would expect to be one (or hell, even two) calls to the Etsy API, into 1 plus however many items you return. Granted if you have 100 items you're selling in a shop, that's 101 API calls in just a few seconds! Call me crazy, but I feel there's got to be a better way to do this than what I've found.

THE QUESTION

What is the easiest way to make an Etsy API call to return all the images (or even the main image) for all the listings in a shop?

like image 698
cereallarceny Avatar asked Jul 22 '12 00:07

cereallarceny


People also ask

Can I export my listings from Etsy?

Export your product data from EtsyFrom your Etsy dashboard, go to Settings > Options > Download Data. Under Currently for Sale Listings, click Download CSV. A CSV file containing your product data is saved to your computer.

Are Etsy pictures copyrighted?

Images on Etsy are copyrighted. Copyright protection goes into effect as soon as you write, draw, photograph, record, etc.

Does Etsy have an API?

The Etsy API provides a simple RESTful interface with lightweight JSON-formatted responses to use many of Etsy's website features, including public profiles, shops, listings, tags, favorites, and sales data, using OAuth to allow both read and write access to users' public and private data.


1 Answers

I ended up using the following code to include everything I needed into one API call:

http://openapi.etsy.com/v2/shops/:shop_id/listings/active?method=GET&api_key=:api_key&fields=title,url&limit=100&includes=MainImage

This way I defined my fields so I don't have unnecessary information, but I also set a limit on the results and used includes=MainImage as a query string. This was to the suggestion of a member of the Etsy developer community.

like image 137
cereallarceny Avatar answered Oct 13 '22 23:10

cereallarceny