REST API suggestions

ddsdds Registered Users Posts: 3 Beginner grinner
I like the simplicity of the REST API vs. the XML-RPC API but the parsing of the responses is difficult and it seems there are some bugs in the API.

First, for smugmug.albums.get , NickName is supposed to be optional. If I call with SessionID and NickName set, I see all of the galleries including private ones. If I exclude NickName, I receive an invalid SessionID error.

Second, to assist easy parsing, instead of using generated tag names with AlbumIDs and ImageIDs embedded in the tag name, could we have something a little more XML-ish? Currently, I see this:

<album12345><Album</album12345><albumid>12345>Array</Album12345></albumid>
<AlbumID>12345</AlbumID>
<Title>My Album</Title>
...
<album54321><Album54321>Array</Album54321></album54321>
...

Instead, I would like to have a response like this:
<album id="12345"><album id="12345">
<title>My Album</title>
...
</album></album>
...

Similarly for images, instead of <Image<image12345>12345</image12345>>12345</Image12345>, how about <image id="12345" />?

It would even save bandwidth :)

Comments

  • NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited April 2, 2005
    I second this..
    dds wrote:
    Second, to assist easy parsing, instead of using generated tag names with AlbumIDs and ImageIDs embedded in the tag name, could we have something a little more XML-ish? ....

    It would even save bandwidth :)
    This one got me, too:-)
    Well, it's a brand new stuff, nobody used it yet, hopefully will be easy to fix..

    My biggest concern now that with the new version getAllSubCategories is screwed up (still works with the old version)

    Cheers!1drink.gif
    "May the f/stop be with you!"
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited April 2, 2005
    dds wrote:
    I like the simplicity of the REST API vs. the XML-RPC API but the parsing of the responses is difficult and it seems there are some bugs in the API.

    First, for smugmug.albums.get , NickName is supposed to be optional. If I call with SessionID and NickName set, I see all of the galleries including private ones. If I exclude NickName, I receive an invalid SessionID error.

    Second, to assist easy parsing, instead of using generated tag names with AlbumIDs and ImageIDs embedded in the tag name, could we have something a little more XML-ish? Currently, I see this:

    <album12345><Album</album12345><albumid>12345>Array</Album12345></albumid>
    <AlbumID>12345</AlbumID>
    <Title>My Album</Title>
    ...
    <album54321><Album54321>Array</Album54321></album54321>
    ...

    Instead, I would like to have a response like this:
    <album id="12345"><album id="12345">
    <title>My Album</title>
    ...
    </album></album>
    ...

    Similarly for images, instead of <Image<image12345>12345</image12345>>12345</Image12345>, how about <image id="12345" />?

    It would even save bandwidth :)


    I'll look into it, but I wouldn't hold my breath.

    Both APIs share a common parent class, so to make maintaining both interfaces (REST & XML-RPC) in lockstep, I have some constraints on what I can do, given the different output formats.

    Sounds like there's a bug in smugmug.subcategories.getAll, which I'll track down, but I think the REST XML is probably going to stay fairly ugly (but functional). We'll see.

    Don
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited April 2, 2005
    dds wrote:
    First, for smugmug.albums.get , NickName is supposed to be optional. If I call with SessionID and NickName set, I see all of the galleries including private ones. If I exclude NickName, I receive an invalid SessionID error.

    Hmm, I'm looking in the code, and there's no "invalid Session" response for that particular function. Are you getting "invalid user" instead?

    If so, it's probably because you're doing an anonymous login. If you are logged in anonymously, and haven't sent a NickName, I have no idea which user you're trying to get albums for. :)

    If I'm wrong, holler, but the code looks good and seems to work for me. :)

    Don
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited April 2, 2005
    onethumb wrote:
    I'll look into it, but I wouldn't hold my breath.

    Both APIs share a common parent class, so to make maintaining both interfaces (REST & XML-RPC) in lockstep, I have some constraints on what I can do, given the different output formats.

    Sounds like there's a bug in smugmug.subcategories.getAll, which I'll track down, but I think the REST XML is probably going to stay fairly ugly (but functional). We'll see.

    Don

    Alright, try it now and see if the XML is more to your liking. :)

    Don
  • NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited April 2, 2005
    smugmug.subcategories.getAll - no changes
    onethumb wrote:
    Alright, try it now and see if the XML is more to your liking. :)

    Don
    Just tried with the version 1.1.0 and API key - same "incompatible result":cry
    Version 1.0 and no API key - still works:):

    HTH
    "May the f/stop be with you!"
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited April 2, 2005
    Nikolai wrote:
    Just tried with the version 1.1.0 and API key - same "incompatible result":cry
    Version 1.0 and no API key - still works:):

    HTH

    Ooops. Helps if I actually restart the web processes when I make a change.

    Try now.

    Don
Sign In or Register to comment.