Uptrends API monitors can check a single response or handle complex multi-step API calls. In this lesson, we go over the basics of setting up an API monitor.
What types of API monitors are there?
- Webservice HTTP/HTTPS
The Webservice HTTP/HTTPS monitors can test a single response. We recommend using Webservice monitors to check on the availability and uptime of an API using basic authentication and content checks. You’ll find more information about Webservice Monitors in our Knowledge Base.
- Multi-step API
If you need to handle redirects, handle authentication, make multiple API calls, or you need to reuse values from one API call to another, you’ll want to use a Multi-step API Monitor. Just keep reading, and we will give you the basic setup information, but you’ll find more setup details in our Knowledge Base.
Add a Multi-step API Monitor
You may want to keep your API documentation handy during the setup process.
- Click the button from Monitors on the Main Menu to open the New Monitor configuration screen.
- Select Multi-step API for the Type.
- Give your monitor a Name.
- Set the Check frequency.
- Switch to the Steps tab.
Okay, let’s take a moment to talk about what we mean by a step.
What is a step?
A step in Multi-step API monitoring consists of one round-trip call to the API (i.e., one request and one response). Within each step, you can define your request and tell Uptrends how to handle the response. Each Multi-step API starts with one empty step. Let’s fill it up!
Setting up a request
When you switch to the Steps tab on your Multi-step API monitor, you see one step in the Steps column, but you’ll find both the Request and Response (on the right) empty for that step. Let’s change that.
The page defaults to the Request (right side column).
Choose your HTTP Method and add the URL. The method defaults to GET, but, if you choose POST, PUT, or Delete, a text field appears where you can input your request body.
Click learn more).to define your request header key and value (
Common headers include name/value pairs:
Note: If you need to use the same value multiple times, you can add the value in the predefined variables section towards the bottom of the Steps screen. We’ve got more information on predefined variables in the Knowledge Base.
Accept paired with application/json or text/xml, or application/x-ww-form-urlencoded
Content-Type with application/json or text/xml, or application/x-ww-form-urlencoded
Authorization with the appropriate data in the Value field.
Handling the response
Once Uptrends sends the request, we need to know what you would like us to do with the response, so now let’s look at your options for handling a response.
Click the Response tab at the top of the column.
Click learn more).(
Select the response type in the first box. Uptrends uses your choice here to set up the rest of the assertion fields. Go ahead and explore all the different types of responses you can choose. For your first assertion, how about checking the status code. You will have two more boxes to complete.
Set the comparison operator. We want to make sure that the request was successful, so let’s choose “Is equal to.”
Put the value you want to check for in the last box. In this case, we want to make sure that the request succeeded, so let’s set it to “200.”
Continue adding assertions as you see fit.
Add any variables for values you may need to reuse by clicking the use variables).button. Set the response type, add the query or expression, and give your variable a name (learn how to define and
Clickif your monitor only needs to make one request, or you can continue adding steps using the + Add step button in the left column.