An API (Application Programming Interface) is software that enables the communication between applications. Maybe you are using your own APIs and/or you rely on third-party APIs. Either way, the correct functioning of the APIs is crucial to the operation of your website and services, therefore you should monitor them.
API monitoring checks whether the APIs that you rely on are available, function correctly and perform well. More information can be found in the article What is API monitoring? .
Uptrends API monitoring offers different types of monitors to set up API monitoring. The choice of type depends on whether you have to deal with a single step or with a chain of requests consisting of multiple steps. The single-step monitor is defined using the Webservice HTTP or Webservice HTTPS monitor type. The monitor for a sequence of steps is defined using the Multi-step API monitor (MSA monitor) type.
The Uptrends app has a Multi-step API monitor hub where knowledge about these monitors and the current status can be found in one place.
Setting up API monitors
The setup of the different types of monitors is documented in these articles:
- Setting up Web Services monitoring
- Setting up Web Services monitoring (SOAP)
- Setting up Multi-step API monitoring
- Setting up Postman API monitoring
Defining Multi-step API monitor steps
When setting up a Multi-step API monitor, you define a step for each HTTP request that is part of the scenario you want to monitor. For each step, you will look at two parts: First, you will specify the details for the Request part, defining what needs to be executed and sent to your API. And second, you will specify the Response part, defining what needs to be checked in the response of our API.
Both the Request and Response parts for each step can optionally be extended using Custom scripting , written in Javascript. You can add your custom scripts for authentication and perform calculations and custom logic to verify correct functionality and content of your API steps.
There are also some definitions for user-defined functions , variables and custom metrics . These are set globally (available to all steps). Check out the articles in the sections below to learn more about setting up the HTTP steps.
Request
The HTTP step request is set up by providing a method and a URL and the request body, then specifying further details like the authentication. The Request definition can also be further modified using custom scripting. See the articles below for more information.
- Authentication
- Client certificates
- Uptrends' client certificate
- File uploads in Multi-Step API
- Custom scripting
Response
Within the response of the step you should define assertions. Assertions are checks that go one step beyond the question if there is a response to the request. An assertion will also check if the response is valid or arrives in time. For each step you can define a number of assertions. In addition to defining Assertions in the Response tab, it is possible to set up completely custom checks and logic using the Custom Scripting feature. Find more information about assertions in these articles:
- Assertions - Introduction
- Assertions - Sources
- Assertions - Comparison operators
- Assertions - Examples using XPath
- Variables
- Handling redirects
- Custom scripting
Global definitions
There are a number of things that you can define for all steps and both the request and response part of them. This comes in handy if you want to use a certain value or function across different steps. Read on in the following articles to find out more:
Script view
You can also edit Multi-step API monitor step definitions directly in the script view. This script contains the entire definition of your Multi-step API definition, that you can copy and paste to other places. See our article on the MSA script editor for more information.
Note that the script view is not the same as the Custom scripting feature that allows you to add custom logic to your scripts.