Comment 2 for bug 719843

Revision history for this message
Michael Nelson (michael.nelson) wrote :

Although adding /reviews/(?P<review_id>\d+)/+update/ would work (and is similar to the /delete/ that was added as part of bug 778301), we'll end up with an API that has lots of - perhaps unnecessary - verbs (delete, update etc.). We did start addressing this, removing unecessary verbs once before with bug 690551.

Basically, it would be possible for use the http methods so that:
1) GET /reviews/(?P<review_id>\d+)/ to get a review
2) PUT /reviews/(?P<review_id>\d+)/ to update a review
3) DELETE /reviews/(?P<review_id>\d+)/ to delete the review (even though we don't remove it from the DB, the resource will 404 after this action, so it's appropriate, I think?).

Just one URL, with different actions. Piston already supports this with its various methods corresponding to the http methods (GET-> read, POST -> create, PUT-> update, DELETE-> delete). See the full example at https://bitbucket.org/jespern/django-piston/wiki/Home

The only issue is that we'd want (1) above to be http, while the others to redirect if necessary to https, but that doesn't seem to difficult (http://stackoverflow.com/questions/5834239/need-to-redirect-apache-for-just-certain-http-methods )