Options

The very very beginings of REST (examples)

kansaschuckkansaschuck Registered Users Posts: 50 Big grins
My apoligizies but I'm in need of some basic understanding of REST and API calls to Smugmug. I'm fairly computer literate but I need some understanding from the very start of how REST work. Where does the code go? How does one run the code? I've have a history in legacy mainframes so I got a ways to go. If I could be directed to full examples that don't make any assumption about previous knownledge that would help.

REST with Smummug 101.

Thanks,

Chuck

Comments

  • Options
    wellmanwellman Registered Users Posts: 961 Major grins
    edited November 20, 2006
    My apoligizies but I'm in need of some basic understanding of REST and API calls to Smugmug. I'm fairly computer literate but I need some understanding from the very start of how REST work. Where does the code go? How does one run the code? I've have a history in legacy mainframes so I got a ways to go. If I could be directed to full examples that don't make any assumption about previous knownledge that would help.

    REST with Smummug 101.

    Thanks,

    Chuck

    This may seem very simplistic, but it works for me. REST is like a client/server thing via the web. You (the client) make a request via an HTTP URL. There's a special URL you call, where the function you're calling is identified and the arguments are passed as strings. Smugmug (the server) then responds to your request in the form of an XML document. You are responsible for parsing that XML document and retrieving the data you need.

    Does that make sense? Once you have an API key, you can experiment for yourself. Just construct the URL for something like smugmug.login.anonymously, plug it into your browser address bar, and then you'll see the XML that is returned.

    Hope this helps a bit.
    -Greg
  • Options
    kansaschuckkansaschuck Registered Users Posts: 50 Big grins
    edited November 20, 2006
    Does that make sense? Once you have an API key, you can experiment for yourself. Just construct the URL for something like smugmug.login.anonymously, plug it into your browser address bar, and then you'll see the XML that is returned.

    Thanks Greg,

    I have a feeling I'm just missing something fairly basic to get going.... so let's start.. if I do the 'anonymously' it just pops me to another page. An API key was never required, nor is there a place for it on the url of :http://www.smugmug.com/hack/method-smugmug.login.anonymously"

    Same with "http://www.smugmug.com/hack/method-smugmug.login.withPassword "

    I'm a supposed to be logged in after executing that URL? I think I understand your explanation of calling for services and that when the return to me I'll need to work with that output...but I can't see how my current calls do anything other any pull up a standard page from a web site.
    Can you explain some more? Thanks!
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 20, 2006
    Hey Chuck,

    There is a REST sample here.

    This is more of the type of syntax u need to use...

    http://api.smugmug.com/hack/rest/1.1.1/?method=smugmug.login.withPassword

    obviously, that's missing required parameters, find all the syntax here.

    I recommend using version 1.1.1 for the moment.

    Let me know if you have any questions.

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    kansaschuckkansaschuck Registered Users Posts: 50 Big grins
    edited November 20, 2006
    devbobo wrote:
    Hey Chuck,

    There is a REST sample here.

    This is more of the type of syntax u need to use...

    http://api.smugmug.com/hack/rest/1.1.1/?method=smugmug.login.withPassword

    obviously, that's missing required parameters, find all the syntax here.

    I recommend using version 1.1.1 for the moment.

    Let me know if you have any questions.

    Cheers,

    David


    Well.....


    from the examples and documentation I'm having trouble telling a keyword from info place holder.

    lets start with ?method=smugmug.login.withPassword


    My first thought was that 'smugmug.login' should be replaced with my smugmug login and followed by password.

    ?method=chuck@myaccount.net.chuckspassword

    but viewing the examples in get.image
    ?method=smugmug.images.get&SessionID

    maybe it should be like ?method=smugmug.login&chuck@myaccount.net.chuckspassword

    I'm trying different ones and I getting different errors. I suspect my assumptions from the mainframe coding languages are in conflict with some general standards that must be so standard on the internet that there isn't a general need to mention them in the technical doc or in these examples.

    A true example would help so much. If someone could do the REST call in true form and just slightly phony up the smugmug login and password that would most likely get me on my way. Or.... if someone could just write the command in full syntax pretending that my smugmug login is
    chuck@fakeisp.net and a password of fakepass that would be great.

    Thanks so much for your understand of us dinosars.

    :-)
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited November 20, 2006
    no, smugmug.loging.withPassword is the name of the procedure, and needs to be left as that.

    ok...every parameter after the ? is used in a name/value pair combination like name=value

    therefore, smugmug.login.withPassword would look like this...

    ?method=smugmug.login.withPassword&EmailAddress=introversion&Password=NotTelling&APIKey=blahblah

    note: with the EmailAddress parameter, you can use your email address or smugmug name. I find the latter alot easier.

    So from your example above...
    http://api.smugmug.com/hack/rest/1.1.1/ ?method=smugmug.login.withPassword&EmailAddress=chuck@fakeisp.net&Password=fakepass&APIKey=blahblah

    Hope this makes some sense.

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    kansaschuckkansaschuck Registered Users Posts: 50 Big grins
    edited November 20, 2006
    devbobo wrote:
    no, smugmug.loging.withPassword is the name of the procedure, and needs to be left as that.

    ok...every parameter after the ? is used in a name/value pair combination like name=value

    therefore, smugmug.login.withPassword would look like this...

    ?method=smugmug.login.withPassword&EmailAddress=introversion&Password=NotTelling&APIKey=blahblah

    note: with the EmailAddress parameter, you can use your email address or smugmug name. I find the latter alot easier.

    So from your example above...
    http://api.smugmug.com/hack/rest/1.1.1/ ?method=smugmug.login.withPassword&EmailAddress=chuck@fakeisp.net&Password=fakepass&APIKey=blahblah

    Hope this makes some sense.

    David

    Ok ... now I'm flying along. Thanks everyone.
    wings.gif



Sign In or Register to comment.