Docs » Use an API Test to test an endpoint » Set up an API test

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:

  1. From the landing page of Splunk Observability Cloud, navigate to Splunk Synthetic Monitoring.

  2. Under Tests, select Add new test and select API test from the list. The test creation view opens.

  3. In the Name field, enter a name for your test.

  4. Beside Steps, select Add requests to add requests to your API test. The requests setup page opens.

  5. Add as many requests as you would like to include in your test, including setup and validation steps.

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

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

This image shows two custom property key value pairs, env:prod and role:developer.

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

  • 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:

  1. Enter a name for your first request, such as “Request Auth Token”.

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

  3. In the Request section, choose a method for your request.

  4. Enter the URL for your request, including http or https.

  5. (Optional) To add a request header, select the + button labeled Request Headers and enter the type and content. Requests can include multiple headers.

  6. In the Validation section, enter any validation steps you want to use to validate the request and response.

  7. (Optional) Select + Request to add another request to your test.

  8. Repeat until you have added as many requests as you’d like to include in your API test.

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

  1. In the Locations field, enter the locations from which you want to test the URL. You can select one or multiple locations.

  2. In the Device Type field, use the list to select the device from which you’d like to conduct the test.

  3. In the Frequency field, select your desired test frequency from the list.

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

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

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

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

Example 🔗

For an example, see Scenario: Monitor API performance for a critical workflow.

This page was last updated on Jun 05, 2024.