DEV Community

loading...

Rate my understanding of REST

yujiri8 profile image Ryan Westlund ・1 min read

I'm gonna describe what I think RESTful architecture means, and you tell me if I'm accurate.


Every resource - every domain object - is mapped to a URL. A customer with ID 6 might be /customers/6, and a client can get the customer as a JSON object by sending a GET request to that URL. An order linked to the customer could be at /orders/52.

Mutating of data generally happens on the client, and multiple HTTP verbs are used: POST /customers to create a resource (which should return a response revealing the ID of the new custoemr), PUT /customers/6 to update (which is idempotent), DELETE /customers/6 to delete, etc.

Discussion (5)

pic
Editor guide
Collapse
patarapolw profile image
Pacharapol Withayasakpunt • Edited

I would use PATCH to partial update.

GET and DELETE should not have request body. It becomes a problem when you want GET or DELETE body bigger than URL encoded length limit.

About higher level of REST, there is also hypermedia.

Collapse
blessingartcreator profile image
Blessing Hirwa

Totally agree

Collapse
ecyrbe profile image
ecyrbe

I rate you at 2 out 5.
you can read more about REST maturity here

Collapse
yujiri8 profile image
Collapse
misobelica profile image
Mišo

I think this video could be interesting for you 🙂 youtu.be/pspy1H6A3FM the thing is the URL is not very important when it comes to REST.