REST API suggestions
dds
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
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
0
Comments
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!
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
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
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
Ooops. Helps if I actually restart the web processes when I make a change.
Try now.
Don