其他分享
首页 > 其他分享> > restfulAPI

restfulAPI

作者:互联网

API

Application Programming Interface: a piece of software that can be used by another piece of software, in order to allow application to talk to each other. such as Web API

"Application" can be other things:

  1. Node.js' fs or http APIs
  2. Browser's DOM JavaScript API
  3. With object-oriented programming, when exposing methods to the public, we're creating an API

REST 架构

rest接口需要满足的要求

  1. separate API into logical resources

  2. expose structured, resource-based URIs

  3. use HTTP methods(verb)

例如addNewTour,getTour,updateTour, deleteTour

image

  1. send data as json

  2. be stateless

all state is handle on the client. This means that each request must contain all the information necessary to process a certain request. The server should not have to remenber previous requests. all state is handle on the client. This means that each request must contain all the information necessary to process a certain request. The server should not have to remenber previous requests.

比如【下一页】,应该是发送第x页,而不是currentPage + 1

标签:restfulAPI,methods,process,request,Application,API,each
来源: https://www.cnblogs.com/kihyunBlog/p/16399014.html