More and more companies are embracing cloud-based apps and functionality mostly due to customer demand for seamless user experiences. So, it is no wonder that as SaaS applications are exploding, Application Programming Interfaces (APIs) serve as a bridge allowing developers to integrate tools seamlessly with cloud-based platforms.
The number of public and private APIs in use is about 200 million. With those kinds of numbers, it’s safe to say that APIs are important to business success and ROI. No doubt, you’ve seen APIs in real-life situations. For example, without APIs to communicate between applications and assets, a travel website would have no way of querying which 10,000 hotel rooms were available in real-time. Likewise, many websites wouldn’t be able to accept credit card transactions and the like.
Any website or app that fails to deliver reliable functionality is likely to be set aside for a competitor. It’s that simple. That’s why it is important to know the availability, speed, and validity of API responses whether you publish an API for consumption or your website or app relies on one or more APIs.
If an API fails to deliver in any of those areas, you’ve got potential trouble. Uptrends API Monitoring has multiple ways to enable you to safeguard your APIs. Here are some metrics you can monitor to safeguard your APIs.
API availability monitoring
API uptime is one of the simplest and inexpensive metrics you can monitor. Uptrends Webservices monitoring supports REST, and SOAP, as well as any web services reachable through HTTP, HTTPS., you simply put in a URL, formulate a request (with or without basic authentication), and wait for a positive or expected response.
Once set up, Uptrends’ global network of 233 checkpoint locations go to work. A failed check results in an immediate retest to confirm an error. In the event of a confirmed error, Uptrends advanced alerting sends out a notification. Once Uptrends gets a successful result, Uptrends calculates the outage based on the time of the first confirmed error until the time of the first error-free test.
SLA monitoring
A service-level agreement (SLA) sets the expectations between the service provider and the customer and describes the products or services to be delivered, the single point of contact for end-user problems, and the metrics by which the effectiveness of the process is monitored and approved.
If you have an SLA with your API provider or users, you need to know what the uptime percentage is for the API. SLA monitoring keeps a running count of your uptime, making it easy to see what your availability looked like for a given period.
SLA tracking lets you know if your API uptime is within your agreement, coming dangerously close to breaking your agreement, or if you’ve exceeded your allotted amount of unscheduled downtime (see figure below).
API response time
Response time is a critical metric for some API interactions. Slow API responses can increase wait times, make applications appear choppy, and cause other functions to fail that rely on a fast response. You’ve got a couple of different ways to track response times.
Tracking response time using web service monitors
Your Webservice HTTPS/HTTP uptime monitor also tracks your server’s response time, and you can use the value as a basic response time metric and to trigger alerts. Your Check Details report gives you several different performance-related metrics:
- Load time: The total time it took to complete the test.
- Resolve time: Time it took to resolve the URL to an IP address.
- Connection time: Time it took to establish a connection to the server.
- Download time: Time it took to complete the download once started.
The sum of the resolve, connection, and download times result in the Load time metric (see Check Detail report below).
On your monitor’s dashboard, you can view tables and graphs to get a record of your response speed over time. Your dashboard gives you the average timings by the hour, day, or month in the table and chart format (see figure below).
Tracking API response times using Multi-Step API Monitoring
A Webservice HTTP/HTTPS is an effective way to track a single API response for availability, response time, and response codes; however, the monitor can’t validate and reuse data from the response.
Multi-Step API Monitoring can track the response times, validate responses, and reuse data in future API calls. Multi-Step API Monitoring tracks the response times for each API call in the transaction, and by using assertions, you can verify that response times remain within a specified maximum. If the request surpasses the maximum step duration, the test fails.
In the screenshot below, the maximum duration is set to two seconds.
In your Check Detail reports, you get the timings for the individual steps. The excerpt from the Check Detail report below shows the step duration in the upper left corner.
Opening the monitor’s dashboard, you can get per-step-timing averages in table and graph form. The chart and table show all step timings, even those that don’t contain an API call. For example, notice the Wait for seven seconds data below. A wait step allows for additional processing time before moving on to the next step. It is important to remember that wait steps add to the Total time metric for the test.
Checking for latency
Latency, the amount of time it takes for a request or response to travel between the client and the host, is affected by the distance traveled and any network congestion between the two. Latency from network congestion tends to be sporadic and may follow patterns based on the time of the day. However, latency due to distance is fairly constant.
To check for latency issues that your users may experience, we recommend using a Ping Monitor type. A ping test can give you the best information on latency because it bypasses the server’s processing of a regular API request. Although it does take time for the server to acknowledge the ping test, the time and resources needed for a server to formulate a response to a ping test are minimal.
In the example below, you can see that Hanoi and Bangkok both have response times that are consistently 0.5 seconds or more. Consistently high total times metrics are often indicative of a possible latency issue.
To measure the response times in the chart above, we set up a Ping monitor type using Concurrent Monitoring. With Concurrent Monitoring enabled, each designated checkpoint conducts a ping test once a minute. Concurrent monitoring gives you a nearly constant flow of data from your chosen checkpoints allowing you to spot latency problems quickly. However, standard monitoring can also show latency problems, but it takes a longer monitoring period.
Tracking custom metrics
You may have specific data in your responses that you want custom metrics on. For example, your API responds with the number of concurrent users, but you also want to monitor them alongside your API performance data.
You can capture the number of users and include them in your reporting to see how the metric changes over time. You can then generate reports that compare the number of users to your performance metrics.
Last words
Thanks to APIs, ecommerce is evolving at breakneck speed. Because APIs provide a standard way of accessing applications, data and devices, APIs can be scaled based on need instead of investing in expensive in-house software.
Track all the above metrics for the APIs you publish or third-party APIs your app or business depends on. Uptrends’ monitoring gives you the tools you need to verify availability, performance, latency, and responses. Sign up for a free trial and see for yourself.
This article was updated on 03-18-2023.