smugmug.images.get on 1.2.2

David PLDavid PL Registered Users Posts: 80 Big grins
Hello,

I am working on moving from 1.2.0 to 1.2.2 and I am having some problems with smugmug.images.get with the Heavy flag on 1.2.2. This method has been working perfectly with 1.2.0, but I would like to move to 1.2.2 to take advantage of the new LastUpdated filter parameter. I am having the following problems:


1) If the account holder is using a custom domain, the image URLs that are returned are based on the custom domain instead of the [nickname].smugmug.com URL. This would be fine except that downloading using the custom domain URLs doesn't seem to work as it should on an authenticated session. Specifically, even with passing the SMSESS=[activesessionid] in the request header, downloading a non-publicly available image fails using the custom domain URLs.


2) The 1.2.2 API response when using Heavy no longer includes the AlbumURL for each image. I saw that if you add the Extras=AlbumURL to the 1.2.2 request, it will return the URL in an Album struct, but would expect it to be returned automatically with Heavy. Also, I noticed that when you use the Extras=AlbumURL, the response structure in 1.2.2 seems somewhat redundant. Specifically, without the Extras=AlbumURL parameter, the response looks like:
  • Album struct
    • Images array
      • Image struct
but with the Extras=AlbumURL parameter, it looks like:
  • Album struct
    • Images array
      • Image struct
        • Album struct
The response seemed more straight forward in 1.2.0 as it did not include the first Album struct. It seems to make sense to be structured that way especially if the smugmug.images.get method is later expanded to allow for querying based on additional criteria other than by album. That way, the response could include images from different Albums, with all of the associative album information for each image right in the response just as it was in the 1.2.0 response:
  • Images array
    • Image struct
      • Album struct
Thank you

Comments

  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 28, 2009
    Hey David,

    In order to support LastUpdated on smugmug.images.get, I needed to add an ImageCount at the root level and couldn't do that without adding the album element.

    I realise that I am missing a URL element within the top level album element, which would resolve your problem... as you could manually construct the AlbumURL for each image using AlbumURL#ImageID_ImageKey.

    I'll look at the custom domain issue, and potentially add a parameter to force to smugmug urls.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 28, 2009
    David PL wrote:
    1) If the account holder is using a custom domain, the image URLs that are returned are based on the custom domain instead of the [nickname].smugmug.com URL. This would be fine except that downloading using the custom domain URLs doesn't seem to work as it should on an authenticated session. Specifically, even with passing the SMSESS=[activesessionid] in the request header, downloading a non-publicly available image fails using the custom domain URLs.

    actually, if you send &Sandboxed=1 all urls will be returned from photos.smugmug.com instead of the custom domain (or nickname.smugmug.com)..I assume that should work for you.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited July 28, 2009
    devbobo wrote:
    actually, if you send &Sandboxed=1 all urls will be returned from photos.smugmug.com instead of the custom domain (or nickname.smugmug.com)..I assume that should work for you.

    Cheers,

    David


    Perfect. Thanks for the quick response
  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited July 29, 2009
    devbobo wrote:

    In order to support LastUpdated on smugmug.images.get, I needed to add an ImageCount at the root level and couldn't do that without adding the album element.

    ....


    Would it be possible just to put the ImageCount as part of the Images element? For REST, the response could look something like:

    ...<method>smugmug.images.get</method>
    <Images ImageCount="25">
    <Image id="##"...>
    ...
    <Image id="##"...>
    </Images>
    ...

    Or would that only work for REST and not for the other response types (JSON, etc) since I'm sure you would like to keep the response structures similar regardless of the response type? Obviously, I'm using REST.

    I noticed that Flickr's API (e.g., flickr.photos.getRecent) seems to put the returned counts in the response similar to the example above.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited July 29, 2009
    yeah, it won't work for other data types, since you can't mix indexed and associative elements within the same array.
    David Parry
    SmugMug API Developer
    My Photos
  • David PLDavid PL Registered Users Posts: 80 Big grins
    edited July 29, 2009
    devbobo wrote:
    yeah, it won't work for other data types, since you can't mix indexed and associative elements within the same array.

    I understand. Easy enough to parse the response as it is. Thanks.
Sign In or Register to comment.