Creating an API test involves the following three steps:
The following instructions show you how to create a test by using the “HTTP Client”.
After you log in to IBM API Connect Test and Monitor, you land on the HTTP Client.
To reach the HTTP Client from any other page, click HTTP Client in the menu bar at the top of the page.
The HTTP Client page contains the following three sections:
The following instructions use
GET https://us-east.apitest.apiconnect.ibmcloud.com/app/api/examples/retail/products for illustration purposes, which is a built-in API endpoint example. This example requires no parameters to be added to the URL, and requires no request headers or body to be supplied.
In the top section of the HTTP Client, select the type of request that you want from the drop-down menu to the left of the Request url field.
The following options are available:
For our example, select
In the top section, complete the Request url field with the API endpoint URL. For our example, enter:
If you are using a different API endpoint from our example, and it requires one or more parameters, click Params + next to the Request url field. A parameter line is added below the URL that you can edit.
Enter a parameter as a key-value pair.
To add more parameters, click the add icon next to any defined parameter.
To remove a parameter, click the delete icon next to the parameter.
In the center section of the HTTP Client, select the Headers tab. If you’re using our example, you don’t need to supply any headers.
Define a header as key-value pair.
To add more headers, click the add icon next to any defined header.
To remove a header, click the delete icon next to the header.
In the center section of the HTTP Client, select the Body tab. This tab is not available if the request type is
GET, so you don’t need to complete this section if you’re following our example.
Set the body type to either
URL Encoded or
If you set the body type to
URL Encoded, you must provide one or more key-value pairs.
If you set the body type to
Raw, you must complete the following actions:
Click Send in the top section of the HTTP Client.
The response from the endpoint is displayed in the bottom section of the page. You can examine the returned headers and body by clicking the Headers and Body tabs in the response section.
Now that you’ve sent a request and received the response, you can generate the test.
Click Generate Test in the top section of the HTTP Client.
Enter a test name.
From the “Save to Project” drop-down menu, select a project name, or select Create new project to create your own project.
If you selected Create new project, enter a name for the project.
Click the confirm icon to save the test and start the test generation.
After generation is complete, the “All set!” page is displayed. This page confirms the creation of your generated test.
Click Close to continue.
You are now in the test editor, called the Composer. In the Composer you can edit and run the test.