Any Word on the API and the new SmugMug?

2»

Comments

  • jrdavisjrdavis Registered Users Posts: 3 Beginner grinner
    edited January 26, 2014
    FYI, a little friendlier HTML view of the V2 API can be found at http://api.smugmug.com/api/v2. You can just click from one API to another to see how things are connected, and the web pages even let you fill in parameter values and execute the method from the web page. I tried playing around with it and it looks really good overall. A few features it looks like are present: sorting, filtering, and paging support for lists, a general ability to expand referenced objects (similar to the "extras" parameters in the V1.3 API), and a general ability to filter results to only return some of the fields from the object for efficiency reasons.

    Below is one example (just replace [nickname] with your nickname) that returns just the Title, Uri, and ImageCount fields from the user's five most recently updated albums along with their highlight images.

    curl -H "Accept: application/json" --compressed "api.smugmug.com/api/v2/user/[NICKNAME]!albums?Order=Last+Updated+%28Descending%29&MinimumImages=0&start=1&count=5&_filter=Title,Uri,ImageCount&_expand=AlbumHighlightImage" | python -mjson.tool
    


    One thing I can't figure out is how / whether it's possible to do second-level expansion (i.e. I want to get the "ImageSizes" object values from the AlbumHighlightImage object in the same call as the list of albums). Any ideas?
  • thenickdudethenickdude Registered Users Posts: 1,302 Major grins
    edited January 26, 2014
    jrdavis, I believe that is achieved by using a dotted notation like so:
    curl -H 'Accept: application/json' --compressed 'http://api.smugmug.com/api/v2/user/n-sherlock!albums?Order=Last+Updated+%28Descending%29&MinimumImages=0&start=1&count=5&_filter=Title,Uri,ImageCount&_expand=AlbumHighlightImage,AlbumHighlightImage.ImageSizes' | python -mjson.tool
    

    I discovered this from poking around the SmugMug source for their v2 API client:

    http://cdn.smugmug.com/include/js/lib/build/combo/combo.js?sm-api2/048f/sm-api2.js
  • jrdavisjrdavis Registered Users Posts: 3 Beginner grinner
    edited January 26, 2014
    Thanks, Lamah - that did the trick!
  • gluwatergluwater Registered Users Posts: 3,599 Major grins
    edited February 23, 2014
    Update on API 2.0 can be found in this sticky. Please subscribe to that thread for future updates.

    Please also ask any questions or add comments about the new API there so everything is in one place. I am closing this thread.

    API 2.0 is the new API we are still working on. From the posts above in this thread it sounds like some of you are attempting to use it already. It is not supported yet and we will not be answering technical questions about it if you do attempt to use it. There are reasons behind why we have not yet publicly released it yet :D
    Nick
    SmugMug Technical Account Manager
    Travel = good. Woo, shooting!
    nickwphoto
This discussion has been closed.