Options

A few API changes

devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
G'day All,

We released a few API changes today.

- JSONCallback parameter. Adding this parameter to a JSON request results in the following...
JSONCallback=myFunction => myFunction({...});
- We fixed another issue where sites protected with a site password could be iterated using anonymous or non-owner sessions. As a result of this change, a new parameter 'SitePassword' parameter has been added to the following methods on version 1.2.0...
smugmug.albums.get
smugmug.albums.getInfo
smugmug.users.getTree
smugmug.images.get
smugmug.images.getInfo
smugmug.images.getURLs
smugmug.images.getEXIF
smugmug.categories.get
smugmug.subcategories.get
smugmugsubcategories.getAll
Failing to pass this parameter or passing an incorrect value result in the error message.... "invalid user (missing/incorrect site password)". For API version 1.1.1, the error messages have been added, however to pass the parameter an upgrade to 1.2.0 is required.

The wiki documentation for 1.2.0 is now up-to-date.

Cheers,

David
David Parry
SmugMug API Developer
My Photos

Comments

  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited October 12, 2007
    Hey devbobo:

    After a long break, I'm doing some hacking around with the API again. This time I'm using LWP instead of external calls to curl, which, in retrospect, is pretty nasty.

    Anyways, I'm having problems using the SitePassword parameter with my site. My thoughts are that this should work with an anonymous login, right?

    So I'm doing:

    $login = get "https://api.smugmug.com/hack/rest/1.2.0/?method=smugmug.login.anonymously&APIKey=$apikey" ;

    I get my session key fine, so I parse that with XML::Simple and then pass it to:

    $albumlist = "https://api.smugmug.com/hack/rest/1.2.0/?method=smugmug.albums.get&SessionID=$sessionid&SitePassword=$sitepassword" ;

    But unfortunately, I'm getting a message about invalid user.

    Can you see anything obvious? I've double-checked the $sitepassword, so I'm fairly sure that's not the problem.

    It'd be nice not to have to pass the master password just to get a listing of all the albums. (Which incidentally, does work.)

    Thanks!

    --Darryl
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited October 12, 2007
    Darryl,

    you are logging in anonymously, then calling albums.get... since you are not passing a NickName, the method has no scope fo which to return albums.

    As for your comment about being able to retrieve a list of albums without supplying the SitePassword, you can't do that via the web interface, so why would the api be any different?

    Am I missing anything ?

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited October 12, 2007
    devbobo wrote:
    Darryl,

    you are logging in anonymously, then calling albums.get... since you are not passing a NickName, the method has no scope fo which to return albums.

    As for your comment about being able to retrieve a list of albums without supplying the SitePassword, you can't do that via the web interface, so why would the api be any different?

    Am I missing anything ?

    Cheers,

    David

    Duh, of course I need a nickname. That's what I was missing. Thanks!

    --Darryl
Sign In or Register to comment.