Options

Playing with REST

darryldarryl Registered Users Posts: 997 Major grins
So I finally decided to look at this API.

Got myself logged in using REST and smugmug.login.withPassword

curl -k 'https://api.SmugMug.com/hack/rest/?method=smugmug.login.withPassword&EmailAddress=me@myemail.com&Password=mypassword&Version=1.1.1&APIKey=myapikey'

(Where or how would I hash the Password if I wanted to use that? The docs don't specify what hashing mechanism they use. I realize that withPassword returns a passwordhash along with the SessionID, but what good does that do me, since I've already sent my username and password?)

Then tried to get some images info, with the Heavy boolean set:

curl -k 'https://api.SmugMug.com/hack/rest/?method=smugmug.images.get&SessionID=mysessionid&AlbumID=2044451&Heavy=1'

Alas, I got Images, but no metadata -- I'm looking for original filenames

Finally, I tried to logout one of the extra session keys I got when I was still trying to figure things out.

I did:

curl -k 'https://api.SmugMug.com/hack/rest/?method=smugmug.logout&SessionID=mysessionid'

But I get:

<?xml version="1.0" encoding="utf-8" ?><rsp stat="fail">
<err code="18" msg="invalid API key" /></rsp>

Very strange.

Any ideas? Anybody else using REST? I'll try to figure out how to do this with real XML-RPC commands and see if I get the same results...

--Darryl

Comments

  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited October 24, 2006
    Darryl,

    ok, firstly hashing...log in smugmug.login.withPassword returns the passwordHash. The intention of this is so that it could be persisted to disk,etc so that in the future the smugmug.login.withHash method could be used in its place for an auto login. There is no method for manually hashing a password.

    smugmug.images.get with Heavy does return the FileName if you are the owner of the album. if you aren't seeing this, can you please post your response.

    I can't seem to see the response you posted for smugmug.logout, but i think it must have been Invalid API Key ? I am aware of that issue, not sure if it has been submitted as a bug yet.

    Let me know if u have any other questions.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    darryldarryl Registered Users Posts: 997 Major grins
    edited October 24, 2006
    devbobo wrote:
    <rsp stat="fail">Darryl,

    ok, firstly hashing...log in smugmug.login.withPassword returns the passwordHash. The intention of this is so that it could be persisted to disk,etc so that in the future the smugmug.login.withHash method could be used in its place for an auto login. There is no method for manually hashing a password.

    smugmug.images.get with Heavy does return the FileName if you are the owner of the album. if you aren't seeing this, can you please post your response.

    I can't seem to see the response you posted for smugmug.logout, but i think it must have been Invalid API Key ? I am aware of that issue, not sure if it has been submitted as a bug yet.

    Let me know if u have any other questions.

    Cheers,

    David
    </rsp>


    Thanks David:

    I realized what my problem was with not getting the Heavy info. I wasn't using the BETA URL. Oops!

    Good to know about the PasswordHash and that I'm not alone re: the Logout problem. (Yes, it was the Invalid API Key.)

    --Darryl
Sign In or Register to comment.