Create Your First API Test
Last updated
Last updated
This page contains getting-started instructions for manually creating a minimum viable API test, a simple one-step test that calls the status endpoint in the ThousandEyes API, and expects an HTTP response code of 200 for success. The overall workflow for creating an API test is shown in the diagram below.
The instructions below focus mainly on the minimum data required to set up a simple API test. See Using the Step Builder for more information on the Step Builder, and the settings available within it.
These instructions focus on the minimum required data for creating an API test. The first part is accessing test settings, as shown below.
First, open the test creation window:
Choose Cloud & Enterprise Agents > Test Settings and click the Add New Test button at the top of the screen.
Choose Web as the layer and API as the test type.
Optionally, Enter a test name and a description, and then continue to the basic test settings as shown below.
Next:
Click Configure Target API and enter at least one step in the Step Builder, as described in Part 2 below. The network target shown in the Network Test Target field is used for the network layer portion of this test (path visualization and network overview).
On the Basic Configuration tab, choose at least one Cloud or Enterprise Agent. If you choose one of your own Enterprise Agents, the Enterprise Agent must have BrowserBot installed.
Click Run Once to run an instant test.
Click Create New Test to save the test. The test will start running immediately.
After waiting a few test rounds, you can see test results in Cloud & Enterprise Agents > Views.
These instructions focus on the minimum required data for creating an API test. The second part is adding a step using the Step Builder, as shown below. (Although the absolute minimum data entry required is a single step with an endpoint, realistically you’d configure a few more items for things like authentication or parameters as well.)
Continue in the Step Builder, under Step 1.
Enter a step name, for example “Status Check”.
Leave GET as the default selection on the drop-down.
Enter a Request URL of https://api.thousandeyes.com/v6/status.json
. The first portion of the URL is the domain name of the Target API, which remains the same in all steps for this API test.
Click Save Configuration to return to the Test Settings configuration screen.
There’s one default assertion rule already in place for a generic “ok” status code 200, so you don’t need to add any for this basic exercise.
The last part before saving the test settings is to run an instant test to ensure that your API test is configured correctly. After completing the Step Builder, you’ll be back on the main test settings screen. From here, you’ll still need to complete the task of saving and enabling the API test.
Click Run Once at the bottom of the new test Basic Configuration tab.
If all is well, you’ll see a test view window in a new browser tab, showing test results.
If there’s a test configuration error that prevents the test from running at all, you’ll see a ThousandEyes error message.
If the test was able to run but one of the values is wrong, for example the domain itself does not exist or the key-value pair was rejected or not recognized, there will be an error shown on the test view window itself.
At this point you can save the test by clicking the Create New Test button on the Configuration tab. The test will be enabled by default, which means it will run on the interval specified in the test settings. As the test runs, it will build up a history that you can see in the test view. If you don’t want to consume too many units, but you want to keep working on the test configuration later, you can also save the test configuration but deselect the Enable check box next to it on the Test Settings main screen.
The next step after creating an API test is to look at the results. See Reading the API Test Views or, for more general information, Getting Started with Views.
More advanced: If you’re already well-versed in the API you want to test, continue reading at Using the Step Builder.
Assertion rules determine what constitutes a minimally successful API test. When you configure a new API test, there’s a default rule already in place that specifies an HTTP status code of 200 (OK) which indicates that the HTTP request, in this case an API call, succeeded: the client requested something and the server provided it.
You can configure in the Assertion Rules tab of the Step Builder. See Using the Step Builder for more information.