Using Postman to test APIs before their integration into your project

Margarita Morozova
Webtips
Published in
4 min readJan 25, 2021

--

Not many beginner developers know there is a very helpful tool that allows you to test APIs before integrating them into your project. Postman is a scalable API testing tool that helps you test either third-party APIs or your own APIs. Your requests can retrieve, add, delete and update data. In this blog post, I’m going to show you how to use Postman to send a GET request to a third-party API.

Photo by Oskar Yildiz on Unsplash

Firstly, you need to download an app on your computer https://www.postman.com/downloads/ or if you prefer you can use an in-browser version. After installation, the app will prompt you to create an account. The program has a very nice graphic interface which makes it easy to use. Once you are logged in, you are taken to the main dashboard.

Since we are going to learn how to send API requests we have to click on create request, located on the right of the dashboard.

For this project, I’m going to test the AirVisual API. After we clicked on create request we are taken to a page where we can start testing. From a dropdown menu (“1”) we can choose what request we would like to test. We enter a URL into the input field (“2”). Section “3” holds request parameters, and then we see a response from a server at the bottom of the page (“4”).

I assume that you carefully read through your API’s documentation and found the URL you need to send your request to, what parameters to use, etc. Here is an example from the AirVisual documentation. We have the URL and all parameters needed to send a GET request.

We copy the URL from the documentation into the input field, changing our parameters, add the API key (you don’t need curly braces around your key), and hit the Send button. If our request was successful, we receive a response from the server with the data we requested.

Under the tab body, you can choose a Pretty formatting, which will display the response in easy-to-read JSON format; the Raw tab displays the data as it is, and under the Preview tab you can see the preview of the page that has been sent.

So everything works fine, now we can integrate this API into our project and send GET requests, knowing that everything works and we are getting back the data we need.

If you need to test the same endpoint often, you can save your requests into a collection.

Click the New button next to My workspace in the left top corner and choose Collection.

In a new window enter a collection name and click the Save button. Now you can see your new collection under the Collections tab.

To add a new request to this collection, click the New button again and this time choose Request. Name the request and choose a collection you want to add this request to and click save.

Now, whenever you come back to the app, you can easily access your saved requests.

--

--