Whether you’re using APIs to power your infrastructure like Omnifone or your apps like Syncano, you need tools and processes in place to make sure those APIs are running smoothly at all times. To stay on top of things, you’ll want to make your APIs aren’t just up, but are also running at top speed and returning the correct data. We’ve shared with you the 6 biggest API testing mistakes you’re probably making and how to fix them, which is a great place to start. API monitoring is essentially just running API tests on a schedule, so once you’ve got that foundation down, here are 5 ways to make sure you’re effectively monitoring your APIs.
1. Monitor your APIs frequently
This first one may seem like a no-brainer, but it’s important to reiterate that APIs are dynamic and have a lot of dependencies—monitoring them on a consistent, continuous schedule is critical to getting an accurate view of API performance. Doing occasional synchronous testing is great for debugging, but you need to capture data flowing through your APIs constantly in order to spot trends and asses API performance. Of course, syncing those test schedules up to the notification channel your team uses, like Slack, PagerDuty and HipChat, will ensure that when your tests do catch a failure, you can dive in and solve the problem immediately.
2. Monitor key API traffic in production
All kinds of unpredictable things can happen in a production environment, triggering random or intermittent problems, which is why production monitoring is so important. This is especially true in the case of transactional APIs. Take, for example, when a customer is in your app putting a charge through a payment API, creating a new lead in a CRM or sending an email to a lead. If an API fails in these circumstances—a credit card payment returns an error and doesn’t go through—you need to be able to detect that error as soon as it happens, before your customers leave your app, losing you revenue. Unfortunately, these types of API calls cannot be simulated, and proactive API monitoring won’t catch them.
Real-time API monitoring logs live API traffic and alerts you of key API transaction failures and anomalies for the APIs you rely on most, whether they’re yours or third-parties’. You can learn more about real-time API monitoring in our free live demo of Runscope Live Traffic Alerts tomorrow, November 3 at 10 a.m. PT. UPDATE: This event has passed.
3. Monitor third-party and partner APIs
Oftentimes, apps and services today rely on partner or third-party APIs to provide a key feature or functionality, like geolocation or social sharing. While you may be monitoring your own APIs, are your partners monitoring theirs? Be sure that those third-party APIs that your apps depend on are living up to your expectations by incorporating them in your API monitoring practices. Companies like uShip, whose main channels for their product involve key API integrations, have a large proportion of their API tests devoted to partner and third-party APIs. When your app breaks, your customer doesn’t know that your partners’ API is the one that’s broken. Monitoring third-party APIs keeps your partners accountable and your customers happy.
4. Monitor for API correctness
An API may be up and running fast, but if it’s returning the wrong data, then all your customers see is a broken app and a bad experience. Data validation is an important part of holistic monitoring. By adding assertions to your API monitoring solution, you can drill down to the data level and make sure your APIs are returning the data you expect. Assertions allow you to specify expected data in the response to a request made in a test run. When a test is run, the outcome is determined by whether or not all the assertions pass.
5. Get a complete performance picture
You also want to check that your API is performing up to speed. It is just as important to identify slowly degrading performance—from intermittent error counts to increases in latency—as it is to know when the service is down entirely. These trends can help you address more complex issues with your API, such as database or hardware related issues, early on, before your API comes screeching to a halt.
See how you can tie all of these best practices together to keep your team in the loop about API issues before your customers notice in our latest webinar, below. Then get started with Runscope for free to cover the bases of API issues and solve problems fast.