views:

74

answers:

2

I'm currently using this JSON to get the latest flickr photos of an ID:

http://api.flickr.com/services/feeds/photos_public.gne?id=49107890@N06&tagmode=any&format=json&jsoncallback=?

Now I need to change my code to display a set instead of an ID. I can get some JSON return with this:

http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=3bfff97a6e1eb0b1a0a7d460c780e273&photoset_id=72157623801339634&per_page=6&format=json

But there are no source URLs? I'm hoping someone with a little more flickr API experience than I can help out. I simply need to supply a Set ID and for it to return the latest 6 thumbnails.

A: 

You can construct the URLs yourself using the guide here: http://www.flickr.com/services/api/misc.urls.html

All the information needed is returned in the JSON response:

http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg

or

http://farm{farm-id}.static.flickr.com/{server-id}/{id}{secret}[mstb].jpg

or

http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{o-secret}_o.(jpg|gif|png)

phidah
Perfect, just what I needed to know :)
Wes
A: 

As phidah pointed out, you can easily construct the URL from the returned data. However, there's a much easier method that just requires adding an extra parameter to your REST request. Just append &extras=url_sqor you can use any of the following, depending on which URL you want:

  • url_sq : Small Square
  • url_t : Thumbnail
  • url_s : Small
  • url_m : Medium
  • url_o : Original (requires special handling)

And you'll get an extra field in your JSON response that contains the URL. Easier in my opinion. :)

Check here for a full list of fields you can add.

kcoppock