UNDERSTANDING API WITH POSTMAN

By Robert Ejiogu, JavaScript Fellow at The Bulb

The Bulb Africa
5 min readJun 7, 2022
Photo by ThisIsEngineering

Hi guys 👋😀, after a while of pondering which of my experience at The Bulb Africa I could write about, I finally decided to write something about a topic that really gave me a headache when learning in our JavaScript track. It is no other than APIs, not your everyday word, right? Well, I thought so, too 😊.

Understanding APIs as a newbie web developer can be overwhelming, and rightly so, as it is essential when working as a professional web developer. As you advance in learning web development, you will come across APIs. As difficult as it might be, you have to learn it if you are serious about ever becoming a web developer.

So, have you ever wondered what is responsible for the connections between computers or computer programs? Well, in a nutshell, that is what an API is.

In this article, I will explain what an API is and show how to apply an API using The Movie Database (TMDB) API.

What are APIs?

According to AltexSoft, “An API is a set of programming code that enables data transmission between one software product and another. It also contains the terms of this data exchange.”

API is short for Application Programming Interface, and it is a tool that allows your program to talk with other applications. You can think of it as a messenger that conveys data back and forth.

There are different types of APIs. However, for the scope of this article, we will be focusing on Database APIs that enable the communication between an application and a database management system.

How does it work?

According to Kinsta, “For two software applications to communicate over the internet, one application (referred to as the client) sends a request to the other applications’ API endpoints (referred to as the server). Depending on the API’s abilities, the client might request a resource from a database or ask the server to perform some action in its environment and return the results.

On receiving the result from the client, the API (or the server) performs the requested operation and sends the result of the operation back to the client in the form of a response. This response can also include any resources that the client requested.”

In this guide, we will be using The Movie Database (TMDB) API for our little demonstration. Then we would be working with the Postman application to make sure this works.

So what is TMDB?

Think of TMDB as a very specialized version of Wikipedia where everything is editable but very specialized around only movie, TV, and actor data. According to themoviedb.com, “The Movie Database (TMDB) is a popular, user editable database for movies and TV shows. As of this writing, TMDB currently has 756,446 movies and 130,263 tv shows.“

TMDB API provides a fast, consistent and reliable way to get third-party data. It allows users to use their data in their application and is available for everyone to use.

Postman

On the other hand, Postman is an API platform for building and using APIs. In this application, we will use API requests, endpoints, and API request methods.

Whenever you want to enable data transmission, you will need to make an API request. Remember I mentioned that an API is like a messenger? Well, you can say an API request is a message!

A clear illustration will be navigating to the favorite music tab on the Spotify app. By clicking that tab, the Spotify app sends a request to the API asking for your favorite music list.

API Request Methods

There are fifteen API request methods in Postman. For the scope of this guide, we will practice just three major ones:

GET: for getting information from the endpoint

POST: making/creating data at that endpoint.

DELETE: used to delete the data we made.

According to Steven Curtis, “An API Endpoint is a URL for a server or a service. These APIs operate through responses and requests — that is, you make a request, and the API Endpoint makes a response.”

A great example of this is the newsfeed page on The Bulb Africa’s website. The base URL is https://thebulb.africa, and your web browser requests the content. The endpoint for this particular page is https://thebulb.africa/newsfeed, and this is obtained by the browser making a GET request and receiving this newsfeed page in return.

Endpoints using The Movie Database (TMDB) APIs.

Now, let’s get into it! For this part, we will need to download a postman application from Google or search for the postman website. Create a workspace, and then inside it, create a collection. For reference purposes, we can call the collection ‘The Movie Database API 3’. The base URL is https://www.themoviedb.org/3

GET: Fight club movie detail

POST: Movie rating

GET: Token

GET: Guest session

DELETE: TV rating

DELETE: Ratings

Conclusion

There are a lot of endpoints from TMDB to lay your hands on! Remember to follow the documentation for each endpoint, and you are good to go, just like that. And oh, you are welcome, by the way! 😁

--

--

The Bulb Africa

The Bulb Africa is a platform for Africans leveraging technology. We provide training and incubation programs that help turn tech ideas into business realities.