PDA

View Full Version : REST API suggestions


dds
Apr-01-2005, 10:44 PM
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>&lt;Album</album12345><albumid>12345&gt;Array&lt;/Album12345&gt;</albumid>
&lt;AlbumID&gt;12345&lt;/AlbumID&gt;
&lt;Title&gt;My Album&lt;/Title&gt;
...
<album54321>&lt;Album54321&gt;Array&lt;/Album54321&gt;</album54321>
...

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

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

It would even save bandwidth :)

Nikolai
Apr-02-2005, 12:49 AM
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

onethumb
Apr-02-2005, 07:53 AM
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>&lt;Album</album12345><albumid>12345&gt;Array&lt;/Album12345&gt;</albumid>
&lt;AlbumID&gt;12345&lt;/AlbumID&gt;
&lt;Title&gt;My Album&lt;/Title&gt;
...
<album54321>&lt;Album54321&gt;Array&lt;/Album54321&gt;</album54321>
...

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

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

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

onethumb
Apr-02-2005, 09:37 AM
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

onethumb
Apr-02-2005, 10:03 AM
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

Nikolai
Apr-02-2005, 10:36 AM
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

onethumb
Apr-02-2005, 10:48 AM
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