New to an API ? What it does and how to use it?

Abhishek Jaiswal
4 min readFeb 19, 2023
Photo by Bimo Luki on Unsplash

When you hang around programmers, you might have heard about APIs and how they can be used to perform certain tasks or retrieve some data. But what are these exactly, and why were they created?

Let me explain the problem with a simple, non-IT related example. When you go to a restaurant and order some food, you interact with the waiter. You can order food and drinks, ask questions about the menu, request and pay the bill, and much more. In this example, the waiter is shielding you from all the complicated stuff that happens behind the scenes. You don’t have to worry about stoves, ovens, dishes, managing stock, or pouring drinks. He is the interface between you and all of the services that a restaurant offers. Giving you a way to interact with the restaurant while still shielding you from all the complexity behind the scenes. In a way, the waiter can be seen as the API of the restaurant.

The term API stands for Application Programmable Interface, and it’s a way for different programs to work together.

Some of the reasons why to use an API’s are :

  • It can be used to get access to data from third parties. In the restaurant example, the waiter can provide you information on the status of your order, without you having to go to the kitchen yourself. Another example would be the weather app that use the API of a third-party to retrieve weather predictions. Apple for instance is using the API of The Weather Channel.
  • API’s allow different apps and services to exchange information. These days, it’s hard to find a service that doesn’t have an API. There are API’s to lookup recipes, lyrics, information on barcodes, zip codes, available parking spaces, public holidays, and so on.
  • API’s can also be used to hide complexity and perform tasks. In the restaurant example, you don’t need to know how to prepare a perfect roll of Sushi, you just order one. Another example would be the operating systems on our computers and phones. App developers don’t have to worry about setting up a WiFi connection, drawing shapes onto the screen to make a beautiful user interface or how to talk to the various sensors like the accelerometer or GPS.
  • API’s can also be used to extend functionality. For instance, on iOS, applications can show a widget in Notification Center. And to do that, the app notifies the system through an API that it has a widget available. And if the user adds it to their Notification Center, the system will contact the app to ask how it should display the widget.
User request for the data from the Server
Server sends back the response to the User

What Does an API Do?

For as foundational as they are to many technical operations, the language and syntax of APIs are quite limited. There are four types of actions an API can take:

  1. GET: requests data from a server
  2. POST: sends changes from the client to the server; think of a POST request as adding information to the server, like making a new entry
  3. PUT: revises or adds to existing information
  4. DELETE: deletes existing information

When you combine the endpoints with these actions, also called HTTP verbs, you can search or update any available information over an API.

How to use an API?

The easiest way to start using an API is by finding an HTTP client online, like REST-Client, Postman, or Paw. These ready-to-use tools help you structure your requests to access existing APIs. The next best way to pull data from an API is by building a URL from existing documentation.

The YouTube video below explains how to pull location data from Google Maps via API, and then use those coordinates to find nearby photos on Instagram.

Video Credit : WEB CONCEPTS

Overall, an API request doesn’t look that much different from a normal browser URL, but the returned data will be in a form that’s easy for computers to read. Here’s what happened when I requested information from the OpenWeather database in my web browser:

Example URL from documentation — request weather for a particular city:{city name}

Type into your browser:,TN&APIID={numberslettersnumbersletters}

Be sure to replace “numberslettersnumbersletters” with your API key, or you will receive a 401 status code telling you that your API key was invalid. Without a valid key, your authentication fails.

Not all APIs will require a key. Many public APIs don’t, like the ones included on this list.

I hope it may have given you some path to start your API journey. Any comment, feedback is highly appreciated to improve this content ❤