REST API
Rest stands for Representational State Transfer
6 constrains
- Uniform interface
- resources based instead of action based
- URI, resources(JSON or XML), http header
- Stateless
- every client request is consistent
- no need to maintain sessions
- Cacheable
- client maintain cache
- Client-Server
- uniform interface separates client and server
- Layered System
- Client cannot tell whether is connected directly to the server or through intermediates
- (Optional) code on demand
HTTP actions:
GET (obtain)
PUT (update/replace)
PATCH (update/modify)
DELETE (remove)
POST (upload)
HTTP RESPONSE Codes
200 OK
201 Created
204 No Content
400 Bad Request
401 unauthorised
403 forbidden
404 not found
405 method not allowed
409 conflict
500 internal server error
CRUD – Create, read, update and delete