一傻谁、設(shè)計原則:
資源暴露描焰,
json傳輸數(shù)據(jù),
利用http的請求方法(get,post,put,delete) 映射數(shù)據(jù)庫的crud栅螟,
無狀態(tài)連接荆秦, 把用戶表示存在客戶端。
二力图、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.
客戶端設(shè)置: Accept表明客戶端接收數(shù)據(jù)的類型吃媒。
Content-Type表示客戶端提交數(shù)據(jù)的類型瓤介。