Loading...
API enables an application to access resources within another. For Example, Uber Eats, and other delivery company websites list your products to their website using your API.
So, API helps us to exchange commands and data with each other digitally. But to do this we require clear protocols and architectures. So, we have some categories of API protocols and architectures. Like REST, SOAP, GRAPQL, etc.
But today we will learn about the REST API.
REST is a set of architectural constraints, which stands for "representational state transfer" and was created by computer scientist Roy Fielding. It is the most popular approach for building APIs.
In order for an API to be considered RESTful, it has to conform to these criteria:
Uniform interface:- All API requests should look concise and the same.
Client-Server:- Client & Server must be completely independent of each other.
Stateless:- Server isn't allowed to store any data related to a client request.
Cache:- Improve performance on the client, scalability on the server-side.
Layered System:- allow for the introduction of proxies, gateways, and firewalls.
Code on demand: responses can also contain executable code.
REST APIs communicate via HTTP requests to perform CRUD operations within a resource. A request is made up of four things:
The Endpoint (or route) is the url you request for. eg:- https://api.spotify.com/v1/artists.
The Method (POST, GET, DELETE, PUT, etc)
The Headers (Provide information such as authentication, body content)
The Data(or Body) (contains information you want to send to the server)
works with XML, JSON, HTTP, and plain text.
provide a great deal of flexibility.
easier to work with
caching is easier
highly scalable
In conclusion, I think this is what REST API? So, I hope this will be helpful for you.