一、设计原则:
资源暴露,
json传输数据,
利用http的请求方法(get,post,put,delete) 映射数据库的crud,
无状态连接, 把用户表示存在客户端。
二、HTTP status codes
1XX - informational
2XX - success
3XX - redirection
4XX - client error: 路径错误, 或这其他错误
5XX - server error
三、Media types
The Accept
and Content-Type
HTTP headers can be used to describe the content being sent or requested within an HTTP request. The client may set Accept
to application/json
if it is requesting a response in JSON. Conversely, when sending data, setting the Content-Type
to application/xml
tells the client that the data being sent in the request is XML.
客户端设置: Accept表明客户端接收数据的类型。
Content-Type表示客户端提交数据的类型。