美文网首页
20180919-RESTful api

20180919-RESTful api

作者: LiuYanPin | 来源:发表于2018-09-19 21:35 被阅读0次

https://www.restapitutorial.com/
1.RESTful-style

  • Uniform Interface
  • Stateless
  • Cacheable
  • Client-Server
  • Layered System
  • Code on Demand (optional)

2.HTTP动作

  • GET
  • PUT
  • DELETE
  • POST
POST http://www.example.com/customers
POST http://www.example.com/customers/12345/orders
GET http://www.example.com/customers/12345
GET http://www.example.com/customers/12345/orders
GET http://www.example.com/buckets/sample
PUT http://www.example.com/customers/12345
PUT http://www.example.com/customers/12345/orders/98765
PUT http://www.example.com/buckets/secret_stuff
DELETE http://www.example.com/customers/12345
DELETE http://www.example.com/customers/12345/orders
DELETE http://www.example.com/bucket/sample
PATCH http://www.example.com/customers/12345
PATCH http://www.example.com/customers/12345/orders/98765
PATCH http://www.example.com/buckets/secret_stuff

3.HTTP状态码

  • 200 OK
  • 201 CREATED
  • 204 NO CONTENT
  • 400 BAD REQUEST
  • 401 UNAUTHORIZED
  • 403 FORBIDDEN
  • 404 NOT FOUND
  • 405 METHOD NOT ALLOWED
  • 409 CONFLICT
  • 500 INTERNAL SERVER ERROR

相关文章

网友评论

      本文标题:20180919-RESTful api

      本文链接:https://www.haomeiwen.com/subject/verwnftx.html