Hacker News new | past | comments | ask | show | jobs | submit login

I am not sure how RESTful that looks to me. I would like to route to the action from the url rather than having to read what's in the body. In your solution, I would need that body parser to differentiate this revert action from an update action.



Irrespective of what is good or bad design, defining an action in the URL goes against the most critical REST principles. Design it whatever way you like, but if you do this, it is not RESTful and you should not refer to it as such.


I think what you have said is correct of how, but not why.

However I think what this whole discussing is missing is the properties that you derive by adhering to a REST design.

I think there should be some tests of a design to see if you are actually getting the benefits of REST.

For example in a REST design you can re-arrange the internal URL's in a server and the site is still usable to clients because they are following links from the root.

Why do we want this ability to rearrange URLs?


The concept of putting URLs in the document is not just so that you can re-arrange them, it's so that you can use HATEOAS.

Example: think of posts here on HN. One thing a specific media format would include is a "reply" link, but on hellbanned posts that link would absent, so that state would be inaccessible to clients.

Or say you've used comments on your blog, so each post has a link to the list of comments about it. Now you switch to Disqus, and so you could change the URL to point to their comments pages instead, and a decent client would use it transparently (assuming good media types).

All of this is taken for granted and used a lot on the real RESTful space: the HTML Web.


RESTful interfaces use HTTP verbs (actions), and the urls contain nouns (things)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: