11

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?

Tyler
  • 11,272
  • 9
  • 65
  • 105
cereallarceny
  • 4,913
  • 4
  • 39
  • 74
  • 1
    as the esty tag has 0 followers on SO, i would think their own community would give you a better answer. –  Jul 22 '12 at 00:47
  • 2
    Right, I've looked through their entire documentation looking for an answer and I've found literally nothing on Google. I had figured the first place to check would be Stack Overflow after that. I'd be pretty astonished if nobody on SO has ever used the Etsy API... – cereallarceny Jul 22 '12 at 00:52
  • Also, I didn't add the etsy tag seeing as I'm not able to add custom tags yet (1500 reputation required), someone who edited my question added that for me (and stole my tag, arg!). – cereallarceny Jul 22 '12 at 00:54
  • hope you posted on their forum to, anyway good luck :-) –  Jul 22 '12 at 00:55
  • Credit to your advice: https://groups.google.com/forum/?fromgroups#!topic/etsy-api-v2/AiGFYOCRF7w – cereallarceny Jul 22 '12 at 01:00
  • 2
    I can't even figure out how to find the shop_id. Seems to me their documentation is horrible – MikeT Nov 14 '14 at 07:30

1 Answers1

16

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.

cereallarceny
  • 4,913
  • 4
  • 39
  • 74
  • I know it is kinda late but How can i includes nested things for example; /shops/:shop_id/receipts?includes=Transactions,Listings but i also want to include MainImage from Transactions – AK-35 Jul 07 '21 at 23:02