Get latest album photos by date or image id?

danielslimdanielslim Registered Users Posts: 1 Beginner grinner
Try to make a live gallery from a live cast with smugmug.images.get method via api 1.3.0, is that a way to pull images from album by date or image id?

I see there's LastUpdated return in the format of
"LastUpdated": "2012-03-07 06:26:01"

If there is, how i go about the api request ?? Like bigger than or after LastUpdated or image id??

Thanks
daniel

Comments

  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited May 17, 2012
    danielslim wrote: »
    Try to make a live gallery from a live cast with smugmug.images.get method via api 1.3.0, is that a way to pull images from album by date or image id?

    I see there's LastUpdated return in the format of
    "LastUpdated": "2012-03-07 06:26:01"

    If there is, how i go about the api request ?? Like bigger than or after LastUpdated or image id??

    Thanks
    daniel

    Take a look at the "LastUpdated" parameter of the smugmug.images.get method. That does exactly what you're asking for -- returns only images in the album where LastUpdated is after the date (epoch format) you specify for that parameter.
  • zeroendlesszeroendless Registered Users Posts: 2 Beginner grinner
    edited May 18, 2012
    Thanks, it works. I have two questions on this method.

    Why ImageCount always return the entire album photos instead of filtered images by date?

    Does the LastUpdated always goes by PST time zone?

    Thanks
  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited May 18, 2012
    Thanks, it works. I have two questions on this method.

    Why ImageCount always return the entire album photos instead of filtered images by date?

    Does the LastUpdated always goes by PST time zone?

    Thanks

    1) I don't know if this was SmugMug's intent, but there is one use for that if your application uses local caching of image info (e.g., your app stores the returned image info for each album in a local database so that the user doesn't have to wait for all the image info to be downloaded everytime they use your app). Since SmugMug hasn't yet added a tombstone response to smugmug.images.get (to identify images deleted since the date provided for LastUpdated), you can use the ImageCount to compare against the number of images in your local database for that album to try to determine if any images were deleted from SmugMug. That is, if the counts don't match, you know your cache needs to be refreshed so what I do is then make an open call to smugmug.images.get (without using the LastUpdated parameter) to download all image info and refresh the cache for that album.


    2) I believe that is correct. However, I don't recall off hand if you also have to compensate for daylight savings time. If one hour really doesn't matter to your app, I wouldn't worry about it.
Sign In or Register to comment.