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.
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.
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.
The URL must point to a JSON or YAML definition file, not the Swagger UI web page.
In the Swagger UI, the definition URL is often displayed in the top bar or under the API title:
If the API is on SwaggerHub, copy the URL from the address bar and replace app.swaggerhub.com with api.swaggerhub.com to get the URL pointing to the definition file:
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.|
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.
|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.
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.
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.
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.
The following OpenAPI features are not supported by the AlertSite monitoring platform: