What is API Monitoring

What is API Monitoring


In today’s world, it’s hard to find an app or a SaaS product that functions without using some kind of HTTP API. Try it yourself, switch off Wifi & Cellular network on your smartphone and try to use some of the apps you have already installed. How many of them continued to work? I bet it’s less than 30% of the apps! As APIs become critical to the operation of many apps and cloud-based services, it becomes more and more important to monitor them. An unhealthy API makes your customers unhappy, the last thing you want.


Table of Contents

Looking for an API monitoring tool?

Testfully offers multi-step tests, Email, Slack, SMS and PagerDuty alerts, team collaboration, historical test results and many more features. Import from Postman supported!

What is API Monitoring?

Let’s start with a clear definition of API monitoring as it sets the baseline for the rest of this article. API monitoring is the automated process of observing the behaviour of running HTTP APIs in different environments and notifying the engineering teams as soon as the monitoring system identifies an abnormality in API. The ultimate goal of API monitoring is to identify issues in APIs as quickly as possible and before customers notice them.

When it comes to monitoring the behaviour of running APIs, we tend to break down the monitoring into three equally essential categories:

  • Availability of the API
  • Performance of the API
  • Correctness of the functionalities the API offers

As mentioned above, the three categories are equally essential and cover different aspects of a running API so let’s go through them one by one.


Availability Monitoring for APIs

In this model of API monitoring, we’re primarily looking for an answer to this question: Is the API currently available and accessible by users directly or indirectly? This kind of monitoring is done mainly by sending requests to status endpoints in specific intervals and ensuring that API always responds. The simplicity of API availability monitoring makes it one of the most popular models of API monitoring between engineering teams, something you should also consider for your APIs. This model is the most popular one, and often, it’s the only kind of monitoring the engineering teams rely on to monitor their APIs. It’s important to note that Availability Monitoring does not cover all aspects of API monitoring, and teams should use it in conjunction with the other two kinds of monitoring.


API Performance Monitoring

Slowness in APIs is usually a sign of an underlying issue within infrastructure or code. API Performance monitoring is the process of monitoring the time it takes for your API to respond to requests and to alert your team if it falls below a certain threshold.


Correctness Monitoring

API correctness monitoring, also known as API synthetic monitoring, is all about verifying the correctness of the functionalities your API offers periodically. Take an API with login functionality as an example. In this case, you would have a test case that tries to log in using a valid username and password. The goal would be to get a valid token, verifying that the API can authenticate an active user and issue a token for them.


Benefits of API Monitoring

We briefly touched on this topic earlier, but I think it worth going into more details about what we get out of practising API monitoring; those are:


Catch bugs early

Monitoring your API gives you a chance to catch any bugs or issues early enough and before your API is released to the customer and potentially impact the end-user experience.


More confidence for your team

Combined with API testing, API monitoring gives your engineering teams more confidence to roll out changes faster without fear of breaking things unintentionally. The more comfortable your team is with releasing software, the faster they release new features to your customers.


Be the first one to know about an issue

Thanks to the API monitoring, you will be the first to know about any issues with your API and not your customers or business partners who rely on your API to operate. Moreover, the sooner you know about a problem, the faster you can act on it, and it most likely will have minor damage to your service.


How to monitor your API?

Most API monitoring solutions verify the availability, performance and correctness of an API via user-defined tests. End-users (you, engineers, software testers, DevOps engineers) define test cases by including information about the API under the test and expected behaviour. Depends on the solution, sometimes you need to have programming skills to be able to define tests. Testfully does not require programming skills to create tests, so everyone in your team can contribute to the API monitoring.


Production vs Non-Production Monitoring

When it comes to API monitoring, most engineering teams monitor running APIs in production environments as customers use those APIs. Monitoring non-production APIs, on the other hand, can also be beneficial as it allows you to spot the potential issues before they land in production and impact your customer experience. One good practice is to release your API to a non-production environment, monitor it for some time using an automated API monitoring solution, and make it available to your customers afterwards.


Start your API monitoring journey

Ultimately, you want an API monitoring solution in place that constantly monitors your running API from the availability, performance and correctness perspective and notifies your team as soon as it identifies any abnormality. We recommend our customers take the Think Big / Start Small approach when it comes to API monitoring. Using this approach, you will get immediate values without investing a lot of your time in setting up the test cases. The plan below can get you started very quickly.

  • Start with monitoring the availability of your API as it is probably the easiest to start with and gives you an immediate value: as soon as your API goes down, you will get a notification. It usually takes about 2 minutes to add an availability test in Testfully and schedule it to run periodically in the background.

  • Once you’re up & running with your availability monitoring, try to monitor the correctness of some critical functionalities your API offer. To give you an idea, we will go through some examples.

    • Does your API require access tokens or API keys to access specific endpoints? Pick a protected endpoint, try accessing it by passing a valid token. Did the endpoint respond correctly to your request?
    • Does your API do user authentication? Try to log in using a valid set of username and password. Did the endpoint accept your request? Did you get the token? Try to use the issued token to access one of the endpoints that are protected.
  • Try to extend your availability tests to monitor both production and staging environments. In Testfully, it’s as simple as adding a new environment and using config values to run a test case against multiple environments.


3rd-party API Monitoring Solutions

Tools for API monitoring play an essential role in the successful execution of API monitoring plans. We have put together a list of items to consider when deciding which API monitoring platform to use:


Offers Availability, Performance and Correctness monitoring

As mentioned earlier, an effective monitoring strategy includes availability, performance and correctness monitoring. Picking a tool that offers a solution for all of the above three categories help you to execute your strategy all under one hood.


Production & Non-Production monitoring capabilities

As mentioned above, there are benefits in monitoring non-production APIs as well. Ideally, your API monitoring solution of choice is built with this concept in mind and offers a way to monitor production and non-production environments using the same set of tests. Using a shared collection of test cases for monitoring both production & non-production APIs saves you time as you don’t need to maintain multiple groups of tests for different environments.


Detailed Historical Data

Logs are critical to troubleshooting any kind of programming issues, and APIs are no different. Pick a tool that offers detailed information about both passed and failed monitoring tests. Using the historical data, you can find the root cause of any problem in your API. Moreover, the historical test data should be easily searchable and available to all members of your organisation.


Flexible Alert System

Alerting is a critical component of any monitoring system. Pick a tool that uses different mediums (e.g. Email, SMS, Slack) for alerting and allows you to customise the way you want to receive alerts. You should be able to have different alert settings for different environments and monitoring tasks. For example, it’s beneficial for the DevOps team to receive alerts for some monitoring tasks while the engineering or test team receive alerts for the other monitoring tasks.


Benefits of using Testfully for API Monitoring

Testfully is built from the ground up as an API testing & monitoring solution and offers a great range of features to cover what you need, including;

  • It supports multiple API environments out of the box to quickly run the same monitoring tasks using environment settings. This feature helps you catch bugs early and before they land in production and cause issues for your customers.
  • Testfully offers a detailed and searchable history of executed monitoring tasks, available to all of your colleagues on any device with a modern browser.
  • A powerful & flexible alert system via Email, Slack and SMS allows you to receive instant alerts as soon as something goes wrong. Moreover, each of your monitoring tasks can have a different alerting policy applied to them.
  • Testfully supports workspaces, a feature that enables teams to work together on building API monitoring tasks.
  • Testfully supports test cases with multiple tests. A feature allows our users to verify the correctness of complex user scenarios requiring more than one HTTP request.
  • Testfully comes with a config management system to store & reuse config values. This feature allows you to update configs once and apply them in all of the used test cases. Moreover, you can leverage this feature to have monitoring tests that are fully executable against both production and staging environments.


FAQ

We monitor the CPU & RAM of our servers and the health of our DB. Do we still need API monitoring?

Yes, absolutely. Those kinds of monitoring only cover a portion of your deployment stack, while API monitoring covers everything and can quickly identify any issue. It’s a good practice to have API monitoring alongside server & database monitoring.


We use one of the major cloud providers. Do we still need to monitor APIs?

Yes. No matter what cloud provider you use, you still need to monitor your API. You might have less chance of downtime due to hardware failure, but there are many more reasons APIs become unavailable or start malfunction, so it’s essential to monitor them constantly.


Do we need a 3rd-party solution like Testfully for API monitoring?

No. You can roll out a bespoke solution for API monitoring, but it will take more time and potentially cost more to set up, run, and maintain your monitoring solution.


What’s the difference between API testing & API monitoring?

API testing, in general, is the automated process of verifying the correctness of different features within your API. Often teams practice API testing while building APIs to make sure APIs function correctly. On the other hand, API monitoring is all about monitoring the availability, performance, and correctness of APIs after teams release them to different environments. API testing & API monitoring complete each other and form your ultimate automated test & monitoring strategy.


Do we need to monitor the 3rd-party APIs we use?

When using a 3rd-party API, your solution depends on that API to function smoothly. We recommend checking with the vendor about uptime statistics of their API, their monitoring strategy and how you will be informed when their API is down or have issues. If you’re satisfied with their plan, don’t monitor their APIs; otherwise, consider monitoring their API as well. We encourage you to discuss these matters with your vendor early.

Looking for an API monitoring tool?

Testfully offers multi-step tests, Email, Slack, SMS and PagerDuty alerts, team collaboration, historical test results and many more features. Import from Postman supported!

comments powered by Disqus

Recent Articles

blog-image
7 HTTP methods and how to use them

HTTP protocol works by clients sending requests to the servers and servers responding to the requests. We do CRUD operations (Create, Read, Update, Delete) by sending HTTP requests with different HTTP methods, sometimes called HTTP verbs.



blog-image
Introduction to API Blueprint

API blueprint is a powerful high-level API design language for web APIs. In this article, we want to dive deeper into it and learn more about how it works, the differences between API blueprint and Swagger, and what makes it unique that leads to its extensive use. But before we dig into API Blueprint, we must ensure a solid base of information about the “API first approach” concepts.

blog-image
False positive & false negative in software testing

Exports in automated software testing have borrowed false positive and false negative terms from the medical examination field. In the medical field, the purpose of a test is to determine whether the patient has a particular medical condition or not. As far as software testing is concerned, a false positive indicates a bug when there is none. Conversely, a false negative indicates no bug when there is one.