Set up an API test đź”—
An API test provides a flexible way to check the functionality and performance of API endpoints. See Use an API Test to test an endpoint for an overview of API tests in Splunk Synthetic Monitoring.
Set up an API test đź”—
Follow these steps to set up an API test:
From the landing page of Splunk Observability Cloud, navigate to Splunk Synthetic Monitoring.
Under Tests, select Add new test and select API test from the list. The test creation view opens.
In the Name field, enter a name for your test.
Beside Steps, select Add requests to add requests to your API test. The requests setup page opens.
Add as many requests as you would like to include in your test, including setup and validation steps.
As you build your test, you can use Try now to check that the configuration of your test is valid. Try now results are ephemeral and don’t impact persisted run metrics. For more, see Validate your test configuration with try now.
(Optional) Turn on automatic test retry in the event a test initially fails.
Auto-retry đź”—
Run a test again automatically if it fails without any user intervention. It’s a best practice to turn on auto-retry to reduce unnecessary failures from temporary interruptions like a network issue, timeouts, or other issues. Auto-retry runs do not impact subscription usage, only the completed run result counts towards your subscription usage. Auto-retry requires at least runner version 0.9.29.
Custom properties đź”—
Add custom properties in the test creation page in advanced settings. Use key-value pairs to create custom properties to filter and group dashboards, charts, and create alerts. A list of suggested custom properties is available for each test based on the tags associated with your test. For example: env:test
, role:developer
, product:rum
. When you have multiple key-value pairs the logic is AND among the results. So in this case, the results show all tests for the RUM product with a developer role in the environment test.
Custom properties are single-valued and don’t support multiple values, like region:eu, us
. For each test, you can only use one and unique key. For example, you can have env1:test
and env:test
in the same test, but you can’t have env:test
, and env:prod
.
Key requirements:
Keys must start with an uppercase or lowercase letter. Keys can’t start with special characters or numbers.
The remainder of the key can contain letters, numbers, underscores and hyphens.
Keys can’t be named
test_id
ortest
.Key size can’t exceed 128 characters.
See, Custom properties.
Add requests to your API test đź”—
Follow these steps to add requests to your API test:
Enter a name for your first request, such as “Request Auth Token”.
In the Setup section, use the selectors to add as many setup steps as you want to include. See Use an API Test to test an endpoint to learn more about your options.
In the Request section, choose a method for your request.
Enter the URL for your request, including
http
orhttps
.(Optional) To add a request header, select the
+
button labeled Request Headers and enter the type and content. Requests can include multiple headers.In the Validation section, enter any validation steps you want to use to validate the request and response.
(Optional) Select + Request to add another request to your test.
Repeat until you have added as many requests as you’d like to include in your API test.
Select Save steps & return to test to finish creating your test.
Customize your test details đź”—
Use these steps to customize your test configuration and finish creating your test:
In the Locations field, enter the locations from which you want to test the URL. You can select one or multiple locations.
In the Device Type field, use the list to select the device from which you’d like to conduct the test.
In the Frequency field, select your desired test frequency from the list.
(Optional) Use the Round Robin selector to switch between options: enabling Round Robin means your test cycles through your selected locations one at a time, while disabling Round Robin runs the test from all selected locations concurrently at your selected frequency.
If you want to receive alerts from this test, select + Create detector to set up a detector on the test. Use the dialog box to customize your detector.
Select Submit. This redirects you to the Test History page for your new test. If you’ve just created the test, allow at least one test frequency interval for your test to begin collecting synthetic data.
(Optional) Select Edit test or the three-dot Actions menu in the row for your test to edit, pause, duplicate, or delete this test.
See also đź”—
See Public locations to learn more about the locations from which you can run your test.
See Set up detectors and alerts in Splunk Synthetic Monitoring to learn more about detector options.
Example đź”—
For an example, see Scenario: Monitor API performance for a critical workflow.