In the API Test Editor, you can create, configure, and send requests to the API under test. There are two ways to create a request in the API Test Editor:
For information on adding API steps to web and mobile tests, click here.
Use the step builder
To create a request directly in the API Test Editor, 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.urlishttps://example.com/apiand you want to make a request tohttps://example.com/api/users, enter{{@api.url}}/usersin 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
Building a request in the step builder
Import step from cURL
If you prefer to work with cURL requests, use the following steps to import a cURL request into the Editor:
- Click on the down arrow next to Add step and select Import step from cURL.
- Paste in your cURL request and import it.
Importing a cURL request
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.