What exactly is a Rest API
This question already has an answer here:
Simply, a REST API defines a set of functions which developers can perform requests and receive responses via HTTP protocol such as GET and POST. The REST API should specify what it can provide and how to use it, details such as query parameters, response format, request limitations, public use/API keys, method (GET/POST/PUT/DELETE), language support, callback usage, HTTPS support and resource representations should be self-descriptive…
REST is a highly scalable and cachable architecture that is ideal for designing APIs. Basic ideas behing REST -
URL and headers should uniquely identify the resource, such that it can be cached.
REST apis should be stateless ie result of a api call shouldn't vary depending on the api calls preceding it. Keeping state across apis restricts caching and is thus not considered RESTful.
Use appropriate http verbs ie GET for read and idempotent requests, POST for write requests, PUT for write and idempotent requests, DELETE for deletion of resources.
Return appropriate status codes which are compliant with REST standards for the ease of use and universal cachability over different proxy layers.
HATEOAS ie Hypermedia as the engine of application state which states that most of the URLS shouldn't be hardcoded, instead server-side should guide the client by providing the URLs in its response. The idea is quite akin to how we use websites on our browsers.
REST is a very popular architecture nowadays for development and is an approach to communications between two very different components that is often used in the development of Web Services. Besides, REST does not leverage much bandwidth which makes it a better fit for use over a network. This makes REST a better fit over SOAP because unlike SOAP you do not have to create a server and a client. In case of SOAP you have to separately create a server program to serve data and a client program that would request the data.
Detail Knowledge base can be found at http://srijan.net/blog/rest-api-and-its-utility-real-web-applications
链接地址: http://www.djcxy.com/p/12322.html上一篇: REST是什么意思? 这是什么,为什么它现在变大了?
下一篇: Rest API究竟是什么