REST Architecture / API
REST Architecture
REST, also known as Representational State Transfer, is a set of guidelines and best practices for designing scalable and maintainable web applications. RESTful services use HTTP requests, such as GET, POST, PUT, and DELETE, to retrieve and manipulate resources.
- GET: Used to retrieve a resource.
- POST: Used to create a new resource.
- PUT: Used to update an existing resource.
- DELETE: Used to delete a resource.
Principles of REST
- Client-Server architecture: Separating the client from the server, allows them to evolve independently.
- Stateless: The server does not store any client context, so each request from the client must contain all the necessary information.
- Cacheable: Responses from the server can be cached to improve performance.
- Uniform interface: Resources are identified by URIs, and interactions with resources are performed using a fixed set of HTTP methods.
- Layered system: A client can interact with the server through intermediaries, such as load balancers or proxies, without knowing the details of those intermediaries.
REST API
What is API ?
API stands for Application Programming Interface.
It’s actually an interface between multiple devices, and it helps them to communicate with each other.
It doesn’t matter what programming language we’re using. JavaScript, Python, PHP, Java, C, and every other modern language supports APIs

RESTful API
A RESTful API, which is a kind of API that follows the rules of REST architecture, enables two software applications to interact through the internet by utilizing standard HTTP approaches, like GET, POST, PUT, and DELETE.
fetch('https://swapi.co/api/people/')
.then(res => res.json())
.then(response => console.log(response))
// This code will fetch Data from API store it in Json Format and
// than display it on console
// JSON: Javascript object notation
CRUD ?
Writing soon…!
Request Methods
- HTTP GET
When you load a website. That’s a GET request It’s a request to get data from another computer You’re not simply asking for data and you’re not asking to perform a task You’re not creating, updating, or deleting data Most common request type
- HTTP POST
Ask another computer to create a new resource Returns data about the newly created resource
- HTTP PUT
- HTTP DELETE
- HTTP PATCH

Note: Most API are secure with API key