Categories: R, SEO Glossary

REST API stands for Representational State Transfer Application Programming Interface.

It is a set of rules and protocols for building and interacting with web services. It enables different software applications to communicate with each other over the internet using standard HTTP methods such as GET, POST, PUT, DELETE, and PATCH.

The key principles of REST include statelessness, client-server architecture, cacheability, layered system, and uniform interface, making it an ideal standard for developing web APIs.

How REST API works:

  • Step 1: A client application (like a mobile app or web app) makes an HTTP request to the server. This request includes an HTTP method, headers, and sometimes a request body.
  • Step 2: The server processes the request according to its RESTful services and interacts with the necessary database or data storage.
  • Step 3: Once the server has processed the request, it sends an HTTP response back to the client. This response includes a status code, headers, and a response body.
  • Step 4: The client application receives the response, interprets it, and takes action (like displaying data to the user).

REST API Components:

  • Resources: The key abstraction of information in REST, typically represented by a URL. Resources are accessed and manipulated using the standard HTTP methods.
  • HTTP Methods: The actions you can perform on the resources, including:
    • GET: Retrieve data from a server at the specified resource.
    • POST: Send data to the server to create or update a resource.
    • PUT: Update a resource at the specified URL with new data.
    • DELETE: Remove the specified resource.
  • Status Codes: HTTP responses to indicate the outcome of the request, such as 200 OK, 404 Not Found, and 500 Internal Server Error.
💡REST API in layman terms
REST API is like a waiter in a restaurant.

Imagine the internet as the restaurant, where you (the client) are sitting at a table with a menu of options (web services).

The kitchen (server) is where your order will be prepared. When you decide what you want, you tell the waiter (REST API) your order (a request).

The waiter then goes to the kitchen to tell the chefs what to make and brings back your food (the data or outcome you wanted) once it’s ready.

Just like a waiter can understand different requests (like getting your food, asking for more water, or paying the bill), a REST API understands and handles different types of requests to a server using the web’s standard language (HTTP) to get you what you need from a website or application.