1.2.0 incorrect return codes

rkallarkalla Registered Users Posts: 108 Major grins
It's possible I am misunderstanding the API, but I noticed some unexpected return codes with the following API calls:

logout = Never returns 3/invalid session. Whenever an invalid session is given, instead 18/invalid API Key is returned instead, even if the key is correct.

getTree = Same problem as logout above, invalid user is never returned. If an invalid SessionID or NickName is given, the call always returns 18/invalid API Key (even when the key is correct).

Comments

  • rkallarkalla Registered Users Posts: 108 Major grins
    edited August 24, 2007
    albums.get = does the same thing getTree does when given no sessionID and a valid nickname.
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 24, 2007
    G'day Riyad,

    It's because API Key is tied to a session...so when we try to restore an invalid session, there is no API Key. Hence the reason for that error message. I will check with Don to see if we can do it a different way.

    Can you try smugmug.users.getTree again...with a vaild session id and invalid nickname, I am pretty sure that you will get invalid user as the error message.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • rkallarkalla Registered Users Posts: 108 Major grins
    edited August 24, 2007
    David,
    You are spot-on that worked (valid SID, invalid Nick).

    I think this is just a case of me getting confused by the wording of the API (http://smugmug.jot.com/WikiHome/1.2.0/smugmug.users.getTree) seems to suggest SID or NickName can be used to lookup the records... I've noticed that with a few other API calls that support NickName...

    but from the sound of it, you cannot lookup anything without a valid SessionID... in which case the NickName isn't really useful is it? (If it is, should the wording of the doc be updated? I'll offer to update it once I understand)
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited August 24, 2007
    NicklName is very useful.

    If you are logged with a session (not an anonymous session), calling smugmug.users.getTree without the NickName will return your own tree. By supplying the NickName of another SmugMug user, you can retrieve their public tree.

    If you are logged in with anonymous session, NickName is required for any method that supports it.

    thumb.gif
    David Parry
    SmugMug API Developer
    My Photos
  • rkallarkalla Registered Users Posts: 108 Major grins
    edited August 24, 2007
    Doh!

    Thank you for the clarification. It does indeed sound very helpful now :D
Sign In or Register to comment.