Transaction tests mimic user journeys through web applications. But the user journey may include not only in-app user clicks, but also machine-to-machine interactions, in form of API calls.
When you need to monitor API calls at a granular level, whether to a third-party API or your own microservices, you can use the ThousandEyes synthetic testing framework to emulate conditional backend interactions with API endpoints.
Comparing Browser Synthetics and API Monitoring
The umbrella of ThousandEyes web transactions covers two main areas:
With browser synthetics, you write a script to simulate a user’s journey within a browser. When that script is run, you get detailed measurements of each step in the workflow.
With API monitoring, you monitor without the use of a browser. Your script simulates machine-to-machine interactions, and measures the availability and performance of API endpoints.
Use Cases for API Monitoring
Consider the following common situations when you would use API monitoring:
Your app has to authenticate the user before they can proceed in the workflow.
You need to take the response from one API endpoint, and use it in the request body for another API endpoint. For example, first you fetch a list of records; then you request details for a particular record from that list.
You want to measure the performance of your API gateway, particularly if your APIs are served in a hybrid cloud environment.
Validate API response
When an HTTP response code is not sufficient, you may need to inspect the API endpoint's response body.
Dynamic request parameters
You generate request parameters at runtime. For example, to exercise an API endpoint that supports a timestamp parameter, your ThousandEyes test can generate a timestamp value to use in the request.
Creating API-Monitoring Tests
Consider the following actions that your transaction test script might include:
Transaction test scripts can make requests against one or more HTTP API endpoints, and can chain data from one call to the next, if needed.