Fully resource-oriented, the API is represented in plural form
Path (Endpoint)
http://example.com/libraries //列出所有图书馆
http://example.com/books //列出所有图书
http://example.com/libraries/ID/books //列出某个图书馆的全部图书
http://example.com/libraries/ID/books/ID //列出某个图书馆的某本图书
- Filter criteria
- HTTP verbs
GET Remove Resources from server
POST creates a new resource to the server
PUT updates the resource to the server (the client provides complete resources to the server)
Patch updates the resource to the server (the client provides updated properties to the server)
Delete Deletes a resource
- Status code--Common HTTP status Code
200 server successfully returned to Web page
304 Not modified
404 The requested Web page does not exist
503 Server is temporarily unavailable
504 Gateway Timeout
500 Server Internal Error
- Error handling: If the return status code is 4xx, you should return an error message to the client, usually with the error as the key name, and the fault message as the key value.
REST API Design Specifications