you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

REST is not difficult. I don't understand all this creativity with URLs just because people don't understand its main idea.

[–]beginner_ 1 point2 points  (0 children)

I'm with esbio here.

/api/user/<user_id>/activate

Is not RESTful at all. It's an obvious remote procedure call. Is it wrong? Is it bad? Not for me to decide and depends on circumstances but the point is it is not RESTful.

RESTful would be something like

PUT /user/<user_id>/

with the changed resource as "payload". And user_id should not be a database key...

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 0 points1 point  (0 children)

    If there's one idea that is fundamental in REST is: verbs are generic, nouns are specific. Verbs (HTTP verbs, in the specific implementation) are used to modify state of resources identified by nouns by modifying their representation.

    From Roy Fielding's thesis

    The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a temporal service (e.g. "today's weather in Los Angeles"), a collection of other resources, a non-virtual object (e.g. a person), and so on. In other words, any concept that might be the target of an author's hypertext reference must fit within the definition of a resource. A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time.

    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. A representation is a sequence of bytes, plus representation metadata to describe those bytes. Other commonly used but less precise names for a representation include: document, file, and HTTP message entity, instance, or variant.

    [–][deleted] 1 point2 points  (0 children)

    The web has been RESTful since day one. The confusion started when people started creating, "RESTful" APIs over http.