Table of Contents
- Concepts
- Interfaces of Rest API
- Discussion (1)
- Standard & Framework
- Discussion (2)
- Issues on REST
- Reference
-
REST = REpresentational State Transfer
-
Safe API
- Uniform interface
- Client–server
- Stateless
- Cache-able
- Layered system
- Code on demand (optional)
- Resource must be noun, no verbs in URI
GET https://api.control.nexplore.com/core/ + getEntity/:id
- HTTP Verb: (no use)
- URI: (directory) + action + resource + identifier
GET https://api.control.nexplore.com/core/ + entities/:id
- HTTP Verb: action
- URI: (directory) + resource + identifier
GET https://api.control.nexplore.com/core/ + entities
- HTTP Verb: action
- URI: (directory) + resource (collection)
-
ONLY use the followings
-
Create: Post
-
Retrieve: Get
-
Remove: Delete
-
Replace: Put
-
Partial Update: Patch
- Create: 201
- Retrieve: 200
- Remove: 204
- Replace: 200
- Partial Update: 200
- (Async task): 202
- (User Errors): 4XX
- (System Errors): 5XX
- Retrieve one:
GET /entities/:id
- Retrieve all:
GET /entities
- Create:
POST /entities
- Update/Replace:
PATCH or PUT /entities/:id
- Remove:
DELETE /entities/:id
Is it possible to handle multiple different resources / same resource with different types at one call?
- mPOST?
- mGET?
- mPUT?
- How to manage transaction when more than one resources?
- How to manage failures? rollback / atomic / best effort
- Level 0 - None
- Level 1 - Resources
- Level 2 - HTTP Verbs
- Level 3 - Hypermedia Controls
- A complete specification on how to implement REST API Level 3
- De facto standard: plural (but opinionated)
- use of query as the additional parameters
- put those information to header?
- how to make it transactional?
- too little operations allowed (verbs)
e.g.
- upload
- send
- deliver
- lock / unlock / approved?
- Query parameter is hard to specify data with types (string based)
e.g.
- null vs 'null' vs undefined vs '' (empty string)
-> Graphql