|
|
|
|
|
by mi100hael
2899 days ago
|
|
I disagree with the article and the examples provided. The author has left out a few key components of REST in their initial distillation. Critically: > REST components perform actions on a resource by using a representation to capture the current or intended state of that resource and transferring that representation between components. So given the example from the article: POST /articles/{articleId}/approve
This URL does not point to a resource, and the HTTP verb does not describe what action is being taken upon a resource. It's also not using the representation of a resource to capture intent.It's also worth noting that a GET for the article would return the "status" field and presumably other PUT requests to update the article would either act directly on the article or have other vanity action URLs, making the API more verbose than if everything were done properly. A RESTful design would be in essence CRUD. It would have a url (/articles/{articleId}) identifying a resource, it would have a representation of a resource that includes a "status" field, and changing the status of the article would involve a PUT request to the URL of the article with the desired change of state. |
|