Set of actions that allows you to query a system state
For a web application, it is the set of actions that the server defines via (usually) http
Individual resources are identified in requests using URIs as resource identifiers
When holding a representation of a resource, one has enough information to modify the resource
Headers define how to proccess the message. e.g. MIME type like json or xml.
Aka HATEOAS. State delivered by: body contents, query-string parameters, request headers and the requested URI (client), response codes, and response headers
TL;DR
Make url requests uniform by defining them per resource (e.g. /mesheks) while allowing to manipulate by representation (e.g. /mesheks/1) while using consistent typing (e.g. json) and using the proper "tool" for each state delivery (e.g. 404 code for unfound resource)
Examples:
Further reading: API Gateway (for microservices)
HTTP Verb | CRUD | Entire Location (e.g. /customers) | Specific Item (e.g. /customers/id) |
---|---|---|---|
POST | Create | 201 (Created) with link to /customers/{id} | 404 (Not Found) |
GET | Read | 200 (OK). A list (pagination, sorting,filtering) | 200 / 404 |
PUT | Update/Replace | 404 (Not Found) | 200 / 404 |
PATCH | Update/Modify | 404 (Not Found) | 200 / 404 |
DELETE | Delete | 404 (Not Found) | 200 / 404 |
With REST, the server determines what data will be sent down to the client
Long live GraphQL