The Uptrends Blog

Getting Social

Lesson: API Monitors

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.

Add a Multi-step API Monitor

You may want to keep your API documentation handy during the setup process.

Click the + Add Monitor 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.

-
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.

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.

Optionally, setup the Authentication, Client certificate, check the Ignore TLS/SSL certificate errors if you don’t want to get notifications about these types of errors, and give a Step description.

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.

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 Add variable button. Set the response type, add the query or expression, and give your variable a name (learn how to define and use variables).

Click Save if your monitor only needs to make one request, or you can continue adding steps using the + Add step button in the left column.

Note: We have extensive detailed instructions and examples in the API Monitoring section of the Knowledge Base.