Skip to main content

RESTful API

REST (Representational State Transfer)

badges_REST_API_Express_Stage1.png

What is RESTful API?

RESTful API is an interface design based on REST architecture that enable two computer systems exchange information securely over the internet either used to fetch or give some information from a web service. By REST architecture has imposes conditions on how an API should work All communication done via REST API uses only HTTP request.

Example: To generate monthly pay slips, your internal accounts system has to share data with your customer's banking system to automate invoicing and communicate with an internal timesheet application. RESTful APIs support this information exchange because they follow secure, reliable, and efficient software communication standards.


How do RESTful APIs work?

rest_api_works.png

The basic function of a RESTful API is the same as browsing the internet. The client contacts the server by using the API when it requires a resource. These are the general steps for any REST API call:

  1. The client sends a request to the server by format the request in a way that the server understands.
  2. The server authenticates the client and confirms that the client has the right to make that request.
  3. The server receives the request and processes it internally.
  4. The server returns a response to the client. The response contains request status and information that client requested.

The REST API request and response details vary slightly depending on how the API developers design the API.

Working: A request is sent from client to server in the form of a web URL as HTTP GET or POST or PUT or DELETE request. After that, a response comes back from the server in the form of a resource which can be anything like HTML, XML, Image, or JSON. But now JSON is the most popular format being used in Web Services.