blob: 6669da195cfbf5c039e69192c5661743b70786b7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# RESTful APIs
RESTful APIs, or REST (Representational State Transfer)
is a software architectural style allowing the requesting systems
to access and manipulate textual representation of Web resources
by using a uniform and predefined set of stateless operations.
## Architectural Constraints
### Client-Server Architecture
Separating the UI concerns from the data storage concerns improves
* Portability of UI across multiple platforms
* Scalability (by simplifying the server components)
### Statelessness
Session states are not stored on the server,
but maintained by and sent from the client.
### Cacheability
Improve scalability and performance by caching appropriately.
### Layered System
Improve performance (via caching) and security by intermediary servers.
### Code on Demand (optional)
Transfer executable code.
### Uniform Interface
* Resource identification in requests
* Resource manipulation through representation
* Self-descriptive messages
* Hypermedia as the engine of application state
## The API
### URI
Base URI to collection resource, e.g. http://api.example.com/collection/
Member resource: http://api.example.com/collection/item42
### HTTP methods
* GET: retrieve resource representation
* POST: create member resource
* PUT: replace representation of resources
* PATCH: update resource representation
* DELETE: delete resource representation
|