What does REST API even mean? **A simple explanation**
REST is a way to design software for the Internet that is easy for machines to use.
“REST APIs are the perfect solution when it comes to platforms like WordPress or Drupal because they allow me and other web developers complete flexibility in how we can manage content.”
REST API’s provide freedom of creativity which is one reason why this architectural style has become so popular among those who design websites as well as programmers.
With these types of interfaces you can manage content on your site in an infinite number of inventive ways.
Whether you’re designing with WordPress or any other application that exposes a RESTFul API.
This stuff is really cool, we have come on a long way in this past 20 years which is why we see so many beautiful rich web applications that once connected suddenly changes the game.
REST API Design Principles
RESTful applications adhere to six principles:
4) Uniform Interface
5) Layered System
6) Code on Demand.
A client-server application is one in which the program runs on the server and requests services from, and provides information to, a connected client. This is important in REST. Client-Server architecture exists on a number of popular software platforms, including the Android OS. In this type of structure, the client initiates requests to services that exist on servers.
The most common form of this type of interface is HTTP and HTTP forms the basis for RESTful applications.
The REST philosophy emphasises a statelessness. A stateless system is one in which there is no need to store data locally on the client and each client request is independent of the previous ones. This also means that each request or interaction with a server can be completed at any time. This enables scalability that doesn’t have to worry about storing session state information on the server side .
Caching allows our devices, such as mobile phones and laptops, to store copies of data so they don’t need to request it from the server every time we want it. Caching can also speed up browsing by avoiding asking for data that has not changed since your last visit.
Cache can make web applications more scalable because it reduces load on the server. Instead of generating all dynamically-generated HTML when a user loads a page, the browser may store the generated HTML in memory or on disk and serve it to subsequent requests without any additional processing.
Caching can reduce round trips to the server by storing responses in memory or on disk and serving them from cache, eliminating requests that would otherwise be sent there
The uniform interface principle suggests that all path expressions in relative URLs should be processed in the same way, with the parameters for each operation being passed as a single parameter. This means that if you have been to one page on a website, you can move to another page by clicking on a link
This is especially important because we can use RESTful APIs from any machine and any programming language that accepts web requests. In other words, it is possible to write client code in whatever language we want because all requests are handled uniformly. There is no need to provide “translate functions” for specific languages or libraries.
A layered system is a way to organise the structure and behaviour of web software.
Layering can create separate levels that are connected by abstract interfaces, with each level providing different services on behalf of the one above it. This means that you need to use multiple protocols if you want to exchange data between two layers.
Code-on-demand is a technique that is used in some RESTful APIs to download code modules from a web server in response to user requests. It enables developers to reuse parts of their application logic as well as cut down time spent on generating HTML pages.
Security can be a problem because it involves protecting data from breaches and fraud and we’re talking about the internet here so it has to be solid.
To reduce the risk of security related breaches, a REST API should not require authentication to use but provide some way for developers to protect resources when sensitive data is being accessed. This means that providing a token or an API Key as part of each request is critical in order to keep information safe online.
A video to illustrate the point
This video YouTube video does a good job of explaining this subject nice and simply.
Illustrating the format of the data returned from a successful call (JSON).
Watch it if you are wanting to clear some fog.