REST API DESIGN

REST 缩写: REpresentation State Transfer 最初想法有Roy Fielding 在他的博士论文 Architectural Styles and the Design of Network-based Software Architectures 中提出来。

REST 有6大必要条件

REST enables: performance, scalability, simplicity, modifiability, visibility, portability and reliability.

HTTP 状态码

Tips

Provide Sensible Resource Names

设计一个好的API 80% 的艺术 + 20% 的科学

Use HTTP Response Codes to Indicate Status

Offer Both JSON and XML

Create Fine-Grained Resources

Consider Connectedness

Idempotence

幂等性

###

Reference: