top of page

Monitoring APIs in Postman

Well, the term 'Monitoring' itself defines its meaning. Monitoring an API is nothing but keeping track of the API performance continuously, especially in production. But why do we monitor APIs? what is an API? Lets get clarified with those questions in detail!

What is an API?

API(Application Programming Interface) is an interface that allows two systems to communicate with each other. For instance, we use a weather application on our mobile phone. When we check for weather, the application connects to the Internet and sends data to the server. The server retrieves the data, interprets it, performs necessary actions and sends the weather details back to our phone. In a nutshell, we send a request and receive a response. Simple as that!

Why do we monitor API?

Having a clear picture of what is an API, lets continue to analyze the necessity of monitoring APIs. There are many ways of using a tool. People use systems in different ways, which the testers will not be aware of. As testers, it is really hard to predict all the ways in which a client will use the system. This is when monitoring comes into place. Monitoring allows testers to see some details of what their customers are doing with their product and hence allows them to respond to issues that they hit quickly and effectively. Monitoring helps teams answer these key questions. Are the APIs available? How are the APIs behaving? Are the APIs functioning as expected? This practice helps to identify any outages or below-par performing APIs that can lead to application, website, or dependent services failure. If an API fails, the applications and websites that rely on them also fail. API monitoring makes sure everything is working properly 24/7.

Well! That was a lot about monitoring isn't it! Having a better understanding about monitoring APIs and its purpose, lets move on to learn about how to create a monitor. But before that lets have a quick review of what is postman. Postman tool is an API platform tool for building and testing APIs. It allows you to design, mock, debug, perform automated testing, document, monitor and publish the APIs - everything from one place. Try with me and lets do it together!


Following are the steps to set up monitor in postman

  1. Open Postman tool and under File-->Click New, and the popup appears as shown below

2. Once you click on Monitor, Create a Monitor page appears, where we enter the details about collection, environment, schedule and other options which we can see in detail

Monitor name: Create a name under Monitor name field

Collection: Create a collection first and then select the created collection from the dropdown

Environment: Create an environment first and then select the created environment from the dropdown.(Hope we are familiar about creating environments)

Run This Monitor: Here we specify how often Postman will run the selected collection. This could be as often as every five minutes for a status page, or a basic check once a week on your endpoints. Here the hour timer is selected to run the monitor for every 2 hours

Regions: Postman can automatically select a region where our monitor will run, or we can manually select one or more regions. This is helpful if we want to monitor API health or performance across multiple geographic regions. Here the Postman will automatically select a region.

Receive email notifications for run failures and errors: If we have a monitor that is running quite frequently and it starts to fail, we might get an email every 10 minutes about this failure. Postman controls this by specifying how many times we want to be notified about a failure that is happening every time. Since the number is set as 3 it will stop notifying us by default, once the same monitor has failed three times in a row. The number can be increased or reduced based on our workflows.

Retry on failure: Monitoring a part of the system might occasionally get some kind of glitch, where it is not necessary to investigate every single one. Retry if run fails option will help Postman to immediately run it again before notifying us of the failure. We can specify how many times it will retry (either once or twice).

Request timeout: Postman does limit the total time that a monitor can run for to 5 minutes. But if we had a monitor with few requests and one of them was hanging, it could prevent other requests from running. To avoid this, we can use the request timeout option. We need to specify how long Postman should wait for a request to return data before it considers the request to have timed out.

Delay between requests: Some services need a short pause between requests to allow data to be fully synchronized. If we need to do something like this in a monitor, we can use the delay between requests option to specify the time in milliseconds, that we want the Postman to wait after a request has finished before sending a new one. But remember, if we make the delay too long, we won't be able to run many requests in our monitor. Beware!

Managing redirects behavior: Some API responses return a redirect response. These are responses that have a status code starting with 3. They tell the browser that it should immediately load a new URL, which is provided in the location header of the initial response. Sometimes, we may want to have a monitor that checks that an API endpoint is returning the correct redirect but not want the monitor to actually follow that redirect. In that case, we can use the Don't follow redirects option to tell Postman that we do not want it to load the redirect URL.

Managing SSL Validation: Disabling the SSL validation will tell Postman not to check for an SSL security certificate and so it will prevent our monitors from failing due to missing certificates.

ADDING TESTS TO MONITOR: We could just add a check that verifies the data, but then everytime when there is a minor change in the request, we may need to update our monitor. Instead we could just check directly but adding a test to the request.

We are all set! Now lets run the monitor!

VIEW MONITOR RESULTS: Having learned about how to monitor the APIs in Postman, lets move on to viewing monitor results. Once we have created our monitors, they will run on the schedule we specified. If a monitor fails, Postman will send us an email letting us know that there is a problem. This email will let us know about the failure and give us a link that will take us to the monitor. Postman will also send us a weekly summary of our monitors so that you we see how they are doing overall. Though monitors run on the specified schedule, if we suspect there might be an issue, or we just want to check something out, we can manually run our monitor outside the specified schedule. Lets view the results.

To view the monitor results go to Monitors tab and select the created monitor from the list. If our monitor has not yet run, we will see a notification to that effect, and we can click on the Run button to kick off a run.

Once the monitor has run, we will see a chart showing some information about that monitor as shown below. Each monitor run is represented by a bar in the graph.

Top part: Shows how long the requests took to resolve

Bottom part: Shows how many of the checks have failed . In the above chart checks have passed and shows green. If the checks have failed, it shows red.

Filters: If a monitor is running on a regular schedule, the number of results on this plot will start to get quite large. However, we can still view the results by using the filtering options. These options can be used to narrow down the results that we see.

Test Results: We can view Test Results below the monitor summary to find more detailed information on our tests, including the passed or failed requests, response codes, and response times.

Yay! We have finally reached the last section of monitoring! So long we have learned how to create and run the monitor. Now we are about to learn how to Delete a monitor. Well, you may think why is it so important. And yes it is really important since they will count against the monitor run quota and will create unnecessary load on the service which we are monitoring. So without any delay lets jump into this section.

CLEANING UP THE MONITORS: To clean up a monitor just follow the steps as below

Step 1: Go to Monitors tab and select the monitor which you have created.

Step 2: Click on View more options (...) button, as you see at the corner of the created monitor

Step 3: Click on Delete on the confirmation dialog.

This will remove the monitor and it will no longer run.

Hurray! That's the end! Hope you had better understanding of monitoring APIs and found it informative. Feel free to post your comments. See you'll soon in my next post! Happy testing!

155 views0 comments

Recent Posts

See All


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page