Options

"Invalid session" when calling the API

DanielRDanielR Registered Users Posts: 2 Beginner grinner
Hi All,

I am making calls to the API using JSON, for example
http://api.smugmug.com/services/api/json/1.2.2/?method=smugmug.albums.get&APIKey=myapikeyblahblahblah&NickName=jmcqueen

but I get the response: {"code"=>3, "method"=>"smugmug.images.get", "message"=>"invalid session", "stat"=>"fail"}

when I access the above link in Firefox it works, I get the albums data, but when I call the link from my ruby script, I get the error.

what am I doing wrong?

thanks in advance
Daniel

Comments

  • Options
    MSkaffariMSkaffari Registered Users Posts: 147 Major grins
    edited July 8, 2011
    That's because you have used that browser to log into Smugmug recently and have a valid session cookied on the browser you use to test. The URL you try to access from your script is not formed properly, as you don't have valid session parameter in it, thus fails.
  • Options
    DanielRDanielR Registered Users Posts: 2 Beginner grinner
    edited July 11, 2011
    MSkaffari wrote: »
    That's because you have used that browser to log into Smugmug recently and have a valid session cookied on the browser you use to test. The URL you try to access from your script is not formed properly, as you don't have valid session parameter in it, thus fails.

    I see. And how do I get the session ID?
    The API documentation is sparse and very vague.

    tx
  • Options
    MSkaffariMSkaffari Registered Users Posts: 147 Major grins
    edited July 11, 2011
    Depending on the needs of your application you can either use smugmug.login.anonymously or smugmug.login.withPassword to get an authenticated session
  • Options
    SamirDSamirD Registered Users Posts: 3,474 Major grins
    edited July 11, 2011
    DanielR wrote: »
    I see. And how do I get the session ID?
    The API documentation is sparse and very vague.

    tx
    Here, try this:
    http://www.dgrin.com/showthread.php?t=137990

    I wrote it to help myself remember how to use the API. Maybe it will help you too.
    Pictures and Videos of the Huntsville Car Scene: www.huntsvillecarscene.com
    Want faster uploading? Vote for FTP!
Sign In or Register to comment.