REST is an approach to building APIs with a set of architectural constraints that make them faster, simpler, and more standardized. RESTful APIs follow the principles built around unique URL and URI resources. RESTful APIs enable caching, scalability, and stateless communication with all of the necessary information in each request.
An API is considered ‘RESTful’ when it adheres to the REST principles, which may vary based on specific requirements.
REST Principles
The following principles define the REST principles that an API must follow to be considered RESTful:
Separation between client and server responsibilities.
Stateless: each client to server request should contain all needed information.
Consistent and standardized interactions using HTTP methods, URIs, and representations.
Caching can be applied to responses.
The architecture can consist of multiple layers through the use of proxies or gateways.
Servers can optionally send executable code to clients on demand, although this is rarely implemented.
For example, the DigitalOcean API is considered a RESTful API as it:
Uses the standard HTTP methods: GET, POST, PUT, DELETE.
Uses stateless interactions, meaning that all of the information required to process a request is contained within the request’s headers, parameters, and body.
Uses resource-based URLs, such as https://api.digitalocean.com/v2/droplets.
Generate an API key to use the Paperspace Core API, then install the Paperspace CLI and the Node.js or Go client libraries for additional functionality.