REST is a standard for web services, designed to accept requests and parameters and return a representation of that data, usually in a JSON format but sometimes in XML or HTML format. APIs that use REST architecture must meet these architectural constraints:
- Client-server interactions
- Statelessness
- Cacheablitity
- Uniform interface
- Layered system
The client (a web browser or a remote computer) will send a request to a server at a designated URL endpoint. The request can include parameters that limit the data objects returned, much like conditionals in an SQL statement. It is stateless, meaning that each request must contain the request parameters and cannot refer to the results of another request. The data returned must be explicitly marked as cacheable or non-cacheable, to allow clients to decide if the data can be stored, or must be requested when required. When data is requested, all available API endpoints relating to the data (including links for adding or deleting data, if available) are returned as links along with the data representation. The underlying architecture of the server is not revealed by the API and can be manipulated (machines added or removed) without any change in the API structure.