CommentAPI POST Return

Joe Gregorio

What comes back from the server once you POST a comment via the CommentAPI? That’s the question. Right now the specification says that the only required response is the HTTP status code. Currently there are two differing implementations. One returns a result code of 303 with a Location: header that points to a new URL. Another returns the number of comments for that item.

Any other implementations I am missing?

Any suggestions on how this should work?

You know, specification writing is hard. I just finished a very enlightenting conversation with someone on the RESTLog API that made me realize how much better that specification needs to be. So I am taking some time to read some RFC’s, some of the classics and some of the newer ones. Hopefully I can re-write the specs in a much clearer format that will ease implementation problems.

Spec writing is hard. Please jot down notes as you go of what you’ve learned in making them better.

Posted by Ken MacLeod on 2003-06-19

I expect it to return a 200 on Success and an error (4xx or 5xx) otherwise. All this talk of 303s and the like for simple posting interfaces seems excessive.

Secondly what HTTP status code is returned in the implementation that gives back “number of comments for that item” ?

Posted by Dare Obasanjo on 2003-06-19

My implementation return back an RSS item. This appeals to my sense of symmetry.

Things with default values get filled in. For example, <link> tags may get added. There is plenty of room for expansion for things like <slash:comments>.

Using the same format as the input means thtat there is virtually zero learning curve.

For those who care about such things, I have documented the schema that I use in a WSDL document. In addition to the schema, what the WSDL document says is that if you literally send an RSS item as a document to the given service/port/soap:address/@location, you can expect to get an RSS item back.

An example of such a WSDL document can be found at http://www.intertwingly.net/blog/1447.wsdl

The WSDL document for each entry is referenced in my RSS 2.0 feed via the wsil:description/@location

Posted by Sam Ruby on 2003-06-19

I love the idea of posting a comment as an RSS item and getting an RSS item back, but which item is it? The comment item or the item for the thing being commented? If the former, there’s no way to get back the new number of comments on that item. If the latter, then both the new number of comments and the URL for editing the post could be returned.

Posted by Chris Sells on 2003-06-19

I currently return a 200, but thinking about it, it should probably be a 201 created response, which would then also match the RESTLog posting API.

Posted by Simon Fell on 2003-06-19

Chris: ;-)

Let’s see if I can avoid awakening Joe’s inner hamster….

One <item> in, two <item>s out makes a lot of sense. I can see the potential for a lot of tools benefiting from having direct access to all this information without having to issue additional requests.

Of course, XML has a restriction that a document has exactly one outermost element, so some sort of wrapper element would be required…

Posted by Sam Ruby on 2003-06-19

LOL, my inner hamster..

But for RSS ‘items’ you already have a pre-made envelope, it’s called ‘channel‘.

Posted by Joe on 2003-06-19

comments powered by Disqus