Use the step builder in the API Test Editor to create, configure, and send requests to the API under test.
Building a request in the step builder
For information on adding API steps to web and mobile tests, click here.
To create a new API request, click on the + Add step button and enter the following information into the Request details section:
- Give the request a name. Naming requests helps other members of your workspace understand the purpose of the request.
- Select an HTTP method: GET, POST, PUT, PATCH, FETCH, DELETE, HEAD, or OPTIONS.
- Enter the URL. Use mabl variable syntax to reference the base URL: api.url. For example, if the
api.url
ishttps://example.com/api
and you want to make a request tohttps://example.com/api/users
, enter{{@api.url}}/users
in the URL field. - Use the following tabs to configure any additional settings that the API requires, including:
- Auth - send authentication or authorization settings with your API request
- Params - append params as key-value pairs to the API URL
- Headers - enter request headers as key-value pairs
- Body - add or update data, including uploading files.
- Pre-request - run JavaScript code before the request is made. See the article on adding scripts for more details.
- Settings - apply settings to the request as key-value pairs
After you enter the request details, click on the Send button to test out the request. The API Test Editor shows the response details in the Results section.
To disable redirection for 3xx responses, add the key "followRedirects" with a value of "false" in the Settings tab.
Next steps
After creating a request, use the Validation and variable assignment section to make assertions and create variables from the response of an API step.