On 28/02/2010 15:42, Scott Wilson wrote:
On 28 Feb 2010, at 00:30, Ross Gardler wrote:
In my opinion the REST API needs to be improved, as it stands it is
not very RESTful. A RESTful API uses the HTTP methods as follows:
POST is used to create a resource on the server
GET is used to retrieve a resource
PUT is used to change the state of a resource or to update it
DELETE is used to remove or delete a resource
There are currently many places where these methods are used
incorrectly and thus confusingly.
Before heading off down the route of redefining the REST API I'd like
to understand if it is used or not.
My suspicion is that it is not used a great deal (indeed in trying to
use it this last few days I have found that parts of it just don't
work). Examining the Moodle plugin the REST API is not used at all
(there are todo items all over it to change the code to use the REST API).
Can we consider rebuilding it now before people start to adopt it?
Should we instead adopt a deprecate and replace approach?
Ross
Looking at the connector framework code I think I found the problem -
you expected POST participants/ {params} to return some XML. It doesn't,
it just returns a status code (201 if created, 200 if unchanged, etc).
Removing the code that attempts to parse the response body as an XML
document removes the problem, and the REST API works just fine:
Well duh!
Thanks for reminding me why release early, release often is important in
open source. Thanks also for fixing it and helping me get to the
important new multi-user demo code working as a result.
[this does not affect my request to reconsider the RESTfullness of our
API - just proves there is nothing broken in the current implementaiton]
Ross