What’s RESTful API?
Published: 2022-11-10 02:15:09

what are RESTful APIs? but before we go further we know what a RESTful API is, we must first know what an API is? API (Application Programming Interface) is An application programming interface is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. In simple terms, it can be interpreted as an interface in the form of a collection of functions that can be executed by other programs. We see in the image below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfubtuu6urpwwvbkq5ju.png)

As we saw in the case of facebook above we can synchronize between services. Facebook can be accessed via the web or can be accessed by mobile. The data from each service will also be in sync even though it is opened on two different platforms/devices. So through the API we can access the data that is on Facebook and allow us to cross platforms and share the same data and can be accessed from the mobile platform or website platform.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fhtjh5hpzxallwx1s15o.png)

The application of the API is also still very broad, so it can also be applied to:
• API can be in Programming Language
• API can be in the Library & Framework
• API can exist on the Operating System
• API can exist in Web Service / Web API
Now if anyone where is the REST API? Web Service / Web API in it usually there are two components, the first is SOAP (Simple Object Access Protocol) and the second is REST (REpresentational State Transfer). In this article, we will know what REST is. REST (Representational State Transfer) is a software architectural style that was created to guide the design and development of the architecture for the World Wide Web. REST defines a set of constraints for how the architecture of an Internet-scale distributed hypermedia system, such as the Web. So actually REST is Can be seen more clearly in the image below

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g0l9ckektcncqnq0vbsv.png)

In the REST API architecture we can divide it into two parts, namely: Client side and Server side. The server contains databases and applications that serve various client applications. While the Client is an application that consumes the API.
How the API works can be described simply as follows:
• Client application access API
The client will access the API by firing at a specified endpoint. Inside an endpoint there are: the HTTP method used, the endpoint url, and the body (data) that you want to send.
• API makes requests to the server
When an endpoint is accessed, the API will forward it as a request to the server.
• Server processing requests
The server application will then process the request according to the intent and purpose requested on the request.
• Server returns response to Client
When the request is successfully processed, the server will return a response to the client. Response contains the requested/needed data according to the request given. Usually this response is in the form of data (JSON and XML)
Request clients or HTTP requests in order to perform a RESTful API can use the HTTP Method. The HTTP method consists of:
• Create = Post for create a post: Post /users
• Read = Get for find user data details: Get /users/:id
• Update = Patch for update a user: Patch /users/:id
• Delete = Delete for delete a user: Delete /users/:id
RESTful APIs are Stateless, which means there is no state in an application. The stateless nature makes every HTTP request done in isolation, the server does not store any state regarding the client session, each request from the client must contain all the information needed by the server including authentication information, and stateless is one of the requirements to create a RESTful API.
So, it can be concluded that in making a RESTful API there are several conditions, namely as follows.
• Using the correct HTTP methods (GET, PUT, POST, DELETE)
• ENDPOINTS used are nouns
• Stateless
• Using REST correctly
So, do you understand what a RESTful API is? it looks difficult but it would be nice for you to be able to practice the method directly in the next article: