Creating a REST API test
Create a REST API test to test the response time and availability of your web application by using the following HTTP methods: GET, POST, PUT, and DELETE.
About this task
Use REST API tests to monitor the availability and performance of your web application and other URLs in response to REST calls.
Procedure
To create a REST API test, complete the following steps.
-
If you are viewing the Availability Monitoring summary page for your
application, click Add New Test. If you are viewing the Availability Monitoring dashboard, click Add New Test on the Synthetic Tests pane.
- Click Single Action on the Monitoring Setup page; then, click REST API on the Single Action page.
- Enter a meaningful name for your test in the Name field. Add a description of the purpose of your test to the Description field.
-
In the Request section, select the type of method from the Method list and enter a
URL that you want to test with this method.
You can choose GET, PUT, POST, or DELETE. If you choose the PUT or POST method, you can enter body content to test in the Request body (optional) field.
For example, the following REST API test uses the POST method to request that your web app accepts data in addition to testing the availability and performance of that web applications.
- Optional:
Configure your test to include a particular header and value. Enter a header name and header
value in the Header fields.
If the web app that you want to test requires a user login and password, enter "Authorization" into the Header name field. Enter the word
Basic
, a space character, and the base64 encoded value of your username:password into the Header value field.For example, if your user name is Aladdin and your password is OpenSesame, then enter the word
Basic
, a space character, and the base64 encoded value for Aladdin:OpenSesame into the Header value field. -
Configure the warning and critical alert thresholds for your test in the Response
Validation section. Edit the Value and Unit
for each row.
Response times that exceed your warning and critical thresholds trigger alerts.
- Optional:
Click Add Condition to define and add customized response validation
conditions.
Customized response validation conditions are evaluated in aggregate to generate an alert. You can define and add up to six customized conditions for your test.Important:
In Availability Monitoring, each test can generate up to a total of three alerts. Your test reports the alert with the highest severity until all conditions that cause alerts are resolved. For more information, see Alert generation in Availability Monitoring.
You can validate the following data:- Header response code
- Select Header response code to test for one or for a range of HTTP response codes.
- Header property
- Select Header property to test for a particular HTTP header field property and value.
- Body JSON
- Select Body JSON to test for a particular property from a JSON body.
For each condition, enter a property to test for in the Target field, and a value to test for in the Value field. Select an operator from the Operation drop-down menu. Finally, choose an Alert severity of Warning or Critical for your condition.
Important:Numerical values that you enter in the Value field are treated as numbers and not strings by default. To enter a Value for a response validation condition, use quotation marks to distinguish between a string and a number. For example, to test for the string 123, enter "123" in the Value field. To check for the number 400, enter 400 without any quotation marks.
-
Click Verify to create your REST API test and to determine whether your
test request is valid.
Availability Monitoring determines the test validity by using the selected HTTP method and any request headers that you defined for the test. No response validation takes place during test verification.
Your validated test is displayed in the Verified Items table. You can add more URLs by repeating steps 3 - 8.
-
To configure your test settings, click Next.
A summary of the test configuration is displayed. The following message is displayed for the default settings:
Test will occur: Every 15 minutes from 3 public locations and no private locations simultaneously to determine if test exceeds the specified threshold.
-
In the Settings pane, click Edit to display the
current settings for your test.
You can update the following settings:
- Interval defines how often the test runs.
- Testing frequency determines whether your test runs from all locations simultaneously or from a different location at each interval. Select Simultaneous to run your test from all locations simultaneously, or select Staggered to run your test from a different selected location at each interval.
- Locations determines the locations where your test runs
- Select your locations from the list of Public Locations. To select a private location to run your test from, you must first install and configure a private PoP on the machine that you want to run your test from. For more information, see Installing and configuring private PoP locations.
-
Click Save to finish configuring your test; then, click
Finish.
The Availability Monitoring dashboard is displayed. After a minute, the dashboard displays information and data for your new test.