Server responds to requests with a representation of a resource (typically as JSON).
# Origin
Roy Fielding identified 5 architectural concepts that make the web successful in his dissertation (2000):
Addressable Resources
A Uniform, Constrained Interface
Representation-Oriented
Communicate Statelessly
Hypermedia As the Engine Of Application State (HATEOAS)
# Addressable Resources
Before REST was introduced there was often just one address where clients sent requests to.
The functionality or resource was specified within the message body.
REST uses the URI concept for distinguishing between resources within one service
people-service.com/students
people-service.com/teachers
# Uniform, Constrained Interface
Use a limited number of operations to manipulate resources.
HTTP-Method
Description
GET
Read-only, Idempotent, Secure, State will be unchanged
POST
Add a new resource. Not idempotent: Every call will change state
PUT
Create a resource if it doesn’t exist, update it if it exists. Idempotent!
DELETE
Deletes a resource. Idempotent
HEAD
Just as GET, but only status codes will be returned. Idempotent
OPTIONS
List which methods are supported for a resource. Idempotent
# Excursus: Idempotence
An operation is idempotent if it can be applied multiple times without changing the result beyond the initial execution.
When the state changes - it is not idempotent