REST users: Heads up!

onethumbonethumb Administrators Posts: 1,269 Major grins
There are some new API calls coming out soon, and some changes to a couple of existing ones.

As requested by a few people, the REST API's output format is starting to move away from 1:1 matching to the XML-RPC format.

Basically, the XML is becoming a little "heavier" for a few of these new calls, and I'm going to want feedback from everyone using REST as to whether they're good or bad. I can see both sides.

As an example, a call which would grab a bunch of AlbumID and ImageIDs would look something like this today:

<method>blah</method>
<Album id="1">
 <Image id="1" />
 <Image id="3" />
</Album>
<Album id="2">
 <Image id="2" />
</Album>

would now look more like this:

<method>blah</method>
<Albums>
 <Album AlbumID="1">
  <Images>
   <Image ImageID="1">
   <Image ImageID="3">
  </Images>
 <Album AlbumID="2">
  <Images>
   <Image ImageID="2">
  </Images>
 </Albums>


As you can see, there are essentially new container wrappers. I'm not totally sure whether I like id="X" or AlbumID="X" better, so I'll leave it up to you -- what do you prefer?

I'd like to get people's thoughts now, and then have the REST people ready to play with and report back once they're out in the next few days.

It'd also be nice to get a show of hands for who's using REST. I'm a huge fan and vastly prefer it to XML-RPC.

Preliminary thoughts?

Don

Comments

  • KyhiKyhi Registered Users Posts: 12 Big grins
    edited May 1, 2005
    I like it better since it makes it parsing the XML easier. Especially when using the XML Serializer in .Net.

    What about method calls that do not return arrays such as getInfo. Would this return

    <method>smugmug.albums.getInfo</method>
    <Album>
    <AlbumID>000000</AlbumID>
    ...
    <FriendEdit>1</FriendEdit>
    </Album>

    instead of

    <method>smugmug.albums.getInfo</method>
    <AlbumID>000000</AlbumID>
    ...
    <FriendEdit>1</FriendEdit>

    This would be nice since it would be consistent with the other format changes. And, as I said earlier, it would make parsing the XML easier.

    As for id="x" or AlbumID="x", either one would be fine though id="x" is lighter.

    Bill


  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited May 1, 2005
    Kyhi wrote:
    I like it better since it makes it parsing the XML easier. Especially when using the XML Serializer in .Net.

    What about method calls that do not return arrays such as getInfo. Would this return

    <method><method>smugmug.albums.getInfo</method>
    <Album>
    <AlbumID>000000</AlbumID>
    ...
    <FriendEdit>1</FriendEdit>
    </Album>

    instead of

    <method>smugmug.albums.getInfo</method>
    <AlbumID>000000</AlbumID>
    ...
    <FriendEdit>1</FriendEdit>
    </method>
    This would be nice since it would be consistent with the other format changes. And, as I said earlier, it would make parsing the XML easier.

    As for id="x" or AlbumID="x", either one would be fine though id="x" is lighter.

    Bill

    <albums><album albumid="1">
    </album></albums>

    The thought is to make all REST calls return an array. Perhaps not formatted exactly as you have it, but close. Probably drop the AlbumID key/value pair and instead make it a parameter of the array itself, for example.

    Don
  • jberd126jberd126 Registered Users Posts: 36 Big grins
    edited May 3, 2005
    Don,

    I am developing with REST as it was more lightweight and better suited by situation.

    In the situation like <Album AlbumID="1"> I would prefer to have the attribute name simply "id" since otherwise it's redundant.

    I have a side question to this topic. With these new API calls, will there be a call like smugmug.images.getInfo but with the ability to retrieve information for multiple images? When I have an album and I want to retrieve info on all the images, I have to make SO many calls which understandably takes quite a while. My intention is to get all the image information from an album with the smallest number of calls. Retrieving information from all the images in the album may be extreme, depending on how many images there are. It may require a 'page' parameter.

    Thoughts?
  • jefjef Registered Users Posts: 42 Big grins
    edited May 3, 2005
    onethumb wrote:
    As requested by a few people, the REST API's output format is starting to move away from 1:1 matching to the XML-RPC format.

    I don't care one way or the other what the response format is, but are you really sure you want to have different formats for XML-RPC and REST? I thought the point of REST was just to make the request side simpler. What's the justification for making the response side different too? Do people think XML-RPC's response format is too complicated, or what?
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited May 4, 2005
    jef wrote:
    I don't care one way or the other what the response format is, but are you really sure you want to have different formats for XML-RPC and REST? I thought the point of REST was just to make the request side simpler. What's the justification for making the response side different too? Do people think XML-RPC's response format is too complicated, or what?

    XML-RPC's response format is fairly limited and cumbersome.

    There are lots of REST libraries out there that expect nested arrays and iterate through them.

    Currently, the way XML-RPC and REST's output formats differ given the same array of elements causes some difficulty to those who already have used REST and expect smugmug's output to "just work". I want it to "just work" also, so I'm hoping we can get a little closer.

    The output formats will remain similar, and provide the same information, but more in line with what the rest of the industry seems to be doing.

    Don
  • jefjef Registered Users Posts: 42 Big grins
    edited May 4, 2005
    Ok, sounds good. Anyway, I'm glad I didn't switch to REST yet. Once again we see the benefits of laziness!
  • KyhiKyhi Registered Users Posts: 12 Big grins
    edited May 4, 2005
    When do you plan on having the new changes in place? Just wondering.
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited May 5, 2005
    Kyhi wrote:
    When do you plan on having the new changes in place? Just wondering.

    Was sorta hoping I'd get more of a response, but I suppose that might be it for REST users given it's new state.

    Hopefully tomorrow, but if not, probably early next week. I'm busy this weekend.

    Don
  • jberd126jberd126 Registered Users Posts: 36 Big grins
    edited May 10, 2005
    I've posted several times about REST and got... zero replies. Some of them are bug and some of them features. Am I going about this the wrong way?

    Logout via REST gives 'Invalid API Key' error
    http://www.dgrin.com/showthread.php?t=10851
    Is this going to be fixed?

    Invalid XML Format on REST response
    http://www.dgrin.com/showthread.php?t=10550
    Is this a documentation error or is it going to be fixed?

    smugmug.images.getInfo (all?)
    http://www.dgrin.com/showpost.php?p=99815&postcount=4
    Any thoughts on supporting this?
  • NikolaiNikolai Registered Users Posts: 19,035 Major grins
    edited May 10, 2005
    Don,
    As long as XML-RPC interface stays on par with the REST I don't think I'm gonna switch - that is unless you tell me that REST part is faster or "wider".

    It was nice to meet you:-)

    Cheers!1drink.gif
    "May the f/stop be with you!"
  • onethumbonethumb Administrators Posts: 1,269 Major grins
    edited May 11, 2005
    jberd126 wrote:
    I've posted several times about REST and got... zero replies. Some of them are bug and some of them features. Am I going about this the wrong way?

    Logout via REST gives 'Invalid API Key' error
    http://www.dgrin.com/showthread.php?t=10851
    Is this going to be fixed?

    Invalid XML Format on REST response
    http://www.dgrin.com/showthread.php?t=10550
    Is this a documentation error or is it going to be fixed?

    smugmug.images.getInfo (all?)
    http://www.dgrin.com/showpost.php?p=99815&postcount=4
    Any thoughts on supporting this?


    Sorry, I was too busy fixing things to reply. Happens sometimes, and I apologize.

    They should all be fixed in the current beta release. Please let me know, on the BETA thread, if not!

    Don
  • jberd126jberd126 Registered Users Posts: 36 Big grins
    edited May 12, 2005
    onethumb wrote:
    Sorry, I was too busy fixing things to reply. Happens sometimes, and I apologize.

    They should all be fixed in the current beta release. Please let me know, on the BETA thread, if not!

    Don
    Not a problem. I just wanted to make sure that these items were going to be addressed and (unintentially) ignored. Great job on the new API!
    -J
Sign In or Register to comment.