PDA

View Full Version : Request for enhancement images.get method


flyingdutchie
Nov-18-2007, 07:41 PM
Hello Smugmug,

The 1.2.0 method images.get differs from all the other objects' get method that it needs an extra parameter to function: AlbumID. All the other objects' get methods don't need an extra 'search' criterium.

This is probably done to limit the size of the response from the images.get method.

It would be great if the AlbumID parameter were optional so that the images.get returns ALL images of the given owner.

Could this be done in 1.2.0 or in 1.2.1?

Thanks!

devbobo
Nov-18-2007, 08:23 PM
Anton,

I need to chat to Don about this, as it could potentially effect performance, due to some customers having in excess of 8000 albums and 100,000+ images.

Cheers,

David

flyingdutchie
Nov-19-2007, 07:01 AM
Anton,

I need to chat to Don about this, as it could potentially effect performance, due to some customers having in excess of 8000 albums and 100,000+ images.

Cheers,

David

Hi David,

That's what i thought as well. :D A number 100,000+ images is a large download. Maybe it is possible to do large downloads in 'non-heavy' mode only: e.g. with AlbumID, the Heavy parameter can be set to both 0 and 1. Without an AlbumID, the Heavy parameter is ignored and implicitly set to 0 (non-heavy).

Right now, if i want to get all images, i have to loop through all albums (1 request in above example) and then get all images from each album (8000 requests in above example). It works, i tried it :D , but i think that one large request is faster than 8000 smaller ones.

-- Anton.

devbobo
Nov-19-2007, 01:34 PM
Dutchie,

one thing I may be doing shortly, is allowing you to define multiple album ids on that method call.

Something like this...

smugmug.images.get&AlbumID[]=1234&AlbumID[]=4567&AlbumID=5555.

Not sure when this is going to happen yet.

Cheers,

David

yoDon
Nov-24-2007, 09:53 PM
devbobo- You might take a look at how the Amazon S3 API handles listing the contents of a bucket. They add two optional parameters. The first is the maximum number of results to return in the call (which Amazon clamps at 1000). Specifying "0" for the number of results is a shorthand for the max number of results, but in no case will you receive more than 1000 results from a single call. To obtain the remaining results, you can specify the second optional parameter (which I believe they call the marker). If you provide a marker (typically the id of the last result received in the previous call), the API will return the next set of results starting immediately _after_ the marker. In this way you can easily walk through an arbitrarily long list while only interacting with result bundles of a manageable size. Providing a null or empty marker implies starting at the beginning.

-Don

rkalla
Nov-25-2007, 08:16 AM
devbobo- You might take a look at how the Amazon S3 API handles listing the contents of a bucket. They add two optional parameters. The first is the maximum number of results to return in the call (which Amazon clamps at 1000). Specifying "0" for the number of results is a shorthand for the max number of results, but in no case will you receive more than 1000 results from a single call. To obtain the remaining results, you can specify the second optional parameter (which I believe they call the marker). If you provide a marker (typically the id of the last result received in the previous call), the API will return the next set of results starting immediately _after_ the marker. In this way you can easily walk through an arbitrarily long list while only interacting with result bundles of a manageable size. Providing a null or empty marker implies starting at the beginning.

-Don

Don that's a pretty good idea for a public API in general. Besides being a good tip for Smug API, I'm filing that away in my "good to know" part of my brain for future projects.

Thanks for posting dude :thumb