What is REST API?
Representative State Transfer (REST API) is a way of communicating between two computers over the Internet. REST APIs define a set of rules that developers should follow when creating APIs:
- Client-server architecture: the REST API clients (websites or mobile apps) should be decoupled from request processors and data storage (REST API servers) so each can be developed, tested, and scaled independently.
- Statelessness: each request to the REST API server must contain all the required data, and Rest API should not assume that the server has data from previous requests (the server does not store client context).
- Cacheable: the REST API responses must be defined as cacheable or not.
- Layered: the REST API client does not need to know whether it is communicating with a real server, a proxy, or another intermediary. Additional scalability and security can be provided by these intermediate servers (proxies or load balancers).
What is REST?
The REST (Representational State Transfer) is a style of architecture that enforces standards between computer systems on the Internet to make it easier for them to interact. REST has its own rules and limitations, just like other architectural styles.
What is API?
An API (Application Programming Interface) is a specification and protocols for building and integrating applications. APIs allow two applications to communicate by allowing data to be exchanged between them. The APIs are standards-compliant (HTTP and REST) and are easy for developers. Additionally, the APIs are well-documented for use and version control.
REST API in Browser Example
The following is an example of testing a REST API service in a browser:
Server response to our REST API request: