Creating API Monitors From OpenAPI (Swagger) Definitions

Last modified on July 26, 2024

The OpenAPI Specification, formerly known as the Swagger Specification, is an API description format for REST APIs. It provides a way to describe HTTP endpoints, requests, responses, data models, and other information about the API in a machine-readable format (YAML or JSON).

You can use OpenAPI 2.0 definitions to create API endpoint monitors in AlertSite. AlertSite will use the information in the OpenAPI definition to pre-populate the request URL, method, and other parameters for you.

Create a Monitor

Start on the AlertSite UXM Dashboard, hover over + Add New, then select Monitor from the dropdown. Select API on the left, then click API Endpoint Monitor.

Creating an API endpoint monitor in AlertSite

Click the image to enlarge it.

Click the OpenAPI/Swagger button to import your OpenAPI 2.0 definition (YAML or JSON file). You can load it from a URL or upload it from your computer.

Loading an OpenAPI (Swagger) definition to AlertSite

Click the image to enlarge it.

The URL must point to a JSON or YAML definition file, not the Swagger UI web page.

Examples

AlertSite will display a list of operations defined in your OpenAPI definition. Select the operation you want to monitor.

Tip: Operations may be grouped into categories, such as Pet, Store, and User in the image below. Expand the categories to see all operations.
Selecting an operation from those defined in an OpenAPI (Swagger) definition

Click the image to enlarge it.

The request URL and HTTP method will be filled in automatically, along with any query parameter names. You just need to specify the parameter values, add the request body or other required information.

Request configuration

Click the image to enlarge it.

Tip: To change the selected operation, click OpenAPI/Swagger again and select a new operation.

Click Validate Step to test the request. Review the response and add the necessary assertions to verify the response contents.

API response and assertions

Click the image to enlarge it.

To add more requests to your test, click Add Step, then select another operation from those defined in your OpenAPI file. This way you can test chained requests, using variables to pass data between the requests.

API test steps

Click the image to enlarge it.

Once you are happy with the request configuration and assertions, click Next to continue configuring the monitor. You will be asked to select the monitoring locations, run interval and other parameters. For more information about these settings, see API Endpoint Monitor Settings.

Troubleshooting

If your OpenAPI definition file could not be loaded, make sure it has the correct syntax. Paste the file contents into http://editor.swagger.io and see if there are any syntax errors. You will need to fix the errors in order to use your API definition with AlertSite.

Limitations

The following OpenAPI features are not supported by the AlertSite monitoring platform:

  • file upload
  • OPTIONS requests

See Also

Creating an API Endpoint Monitor
API Endpoint Monitor Settings
API Assertions

Highlight search results