Understanding REST APIs

Aashi Gangrade
3 min readNov 18, 2023

--

Introduction:

REST API is an unsung hero behind websites, mobile apps, and online services. Understanding the basics of REST APIs can help you grasp how your favorite apps connect and collaborate, even if you're not a technology expert. Let’s embark on a journey to demystify REST APIs in simple terms.

What is a REST API?

REST is a set of rules that developers follow to create web services. Think of it as a recipe for cooking up a special kind of digital dish. Now, the API (Application Programming Interface) is like a waiter that helps different software applications communicate and share information.

A REST API is similar to a restaurant menu. It’s like when you’re at a restaurant, and you want to order a burger. You don’t need to know how the chef prepares it; you just interact with the menu (API) to get what you want. Similarly, a REST API provides a menu of options for different software to request and exchange data.

The main components of a REST API are:

  1. Resources: In the digital world, everything is a resource — be it a user, a photo, or a weather forecast. Each resource has a unique address called a URL (Uniform Resource Locator). Just like your home address tells the delivery person where to drop your package, a URL guides the software on where to find or send data.
  2. HTTP Methods: Think of these as actions on the menu. When you click a link or button on a website, you’re performing an action. In a REST API, we use HTTP methods to perform actions on resources. These methods include GET (fetch), POST (create), PUT (update), and DELETE (remove).
  3. When you order pizza online, you make a request and the restaurant confirms your order by sending a response. In a REST API, your software sends a request to a URL with an HTTP method, and the server responds with the requested data.

Real-Life Example:

Let’s say you’re using a weather app on your phone. This app might use a REST API to fetch the current weather information. Here’s how it works:

  1. You make a request: Your weather app sends a request (like asking for a weather report) to a specific URL provided by the weather service.
  2. Server processes the request: The weather service server receives your request, looks up the latest weather data, and prepares a response.
  3. You receive a response: The weather service sends back the current weather details, and your app displays them on your screen.

Advantages of REST APIs:

  1. Interoperability: Just like you can order from various restaurants using the same food delivery app, different software can communicate using REST APIs, regardless of the technologies they use.
  2. Scalability: Restaurants can handle more orders by having a streamlined process. Similarly, REST APIs enable applications to handle a large number of users and requests efficiently.
  3. Simplicity: Ordering food online is straightforward — you choose what you want, click a few buttons, and it arrives at your doorstep. REST APIs follow a similar simplicity, making it easier for developers to create and maintain them.

Conclusion:

In summary, REST APIs are the digital bridges connecting different software, allowing them to share and exchange information. Just like ordering your favorite meal, interacting with REST APIs involves making requests and receiving responses. Remember that REST APIs are the ones making your favorite apps work together smoothly. It’s like a digital symphony behind the scenes.

--

--

Aashi Gangrade

Software Engineer 2 at Intuit | Backend Developer (Java + Kotlin)