API Calls with HTTPS Requests and Responses

Autonomous allows you to add API steps to your tests so you can:

  • Prepare test data – set your application’s state before a scenario starts.
  • Clean up – remove data that a test created so it does not accumulate over time.
  • Cross‑check back‑end behaviour – verify results that are not exposed in the UI (e.g., submit a form in the UI, then call the back‑end to confirm the record was created correctly).
  • Validate your APIs – confirm that each endpoint accepts the correct inputs and returns the expected status, headers, cookies, and body.
  • Validate your backend - validate the backend business logic behaves as expected.

Adding API Calls

In Autonomous, you can add API calls to custom flow tests through the API step builder interface, pasting cURL or raw HTTP in a test step, or using plain English to describe the request. You have full control over the request method, parameters, headers, cookies, authorization, and body.

Supported HTTP Methods

Adding API call using the API step

  1. In the test editor, click the Add API call button

  1. Select a method for the request:

  1. Place the URL

  1. (Optional) Use test parameters or variables defined in previous steps (ex.{requestId}) in the request.

 

  1. Similarly, you can define custom Headers and Cookies.In the Headers tab, you can either select a predefined header or enter your own key value pair manually.



  1. You can add Authorization if required. The default setting is None. Select Basic authorization to enter a username and password, or choose Bearer token to provide an access token.

  1. You can add a Body (JSON, XML, or Text) if needed. Choose the appropriate body type and enter your content directly. Make sure to manually set the correct content-type header, such as application/json, application/xml, or text/plain, based on the selected format.

  1. Click Add Step
    Autonomous will immediately send the specified HTTP request, validate it, and highlight any issues.

You can hover over the icon or click it to view details of the API response error.

9. Refine the step and click Update Step Autonomous will resend the updated HTTP request, validate it again, and highlight any remaining issues. Once it is executed successfully, click "Close" to exit the API Builder UI.

Tip: To edit an existing API step, click its menu ➜ Edit step.

Viewing Test Responses

You can hover over the (red) or (green) icons, or click them to view details of the API response.

The test response includes the response status, body, headers, and cookies.

Available response information:

  • {response.status} - The HTTP status code (for example, 200)
  • {response.statustext} - The HTTP status text (for example, OK)
  • {response.body} - The body of the response
  • {response.headers} - Case-insensitive dictionary of response headers
  • {response.cookies} - Dictionary of response cookies

Viewing Body, Headers, and Cookies Details

Click to view the body, header, and cookies information in a popup window.

Copying Response Values

Hover over a response value to view options to copy the following information to the clipboard:



Add API Calls by Pasting cURL or Raw HTTP

  1. Copy and paste an entire cURL or raw HTTP request, and Autonomous will translate it into plain English.

Paste cURL Example:

Copy
curl --location 'https://sandbox.applitools.com/api/get-contact-status?id=51522' \
     --header 'accesskey: mysecretkey'

Paste Raw HTTP Example:

Copy
POST /posts HTTP/1.1
Host: jsonplaceholder.typicode.com
Content-Type: application/json
Content-Length: 51
User-Agent: MyRawClient/1.0
Connection: close

{
  "title": "foo",
  "body": "bar",
  "userId": 1
}

  1. Autonomous translates the request into plain English that can be edited directly inline or through the API step builder.


Here are some example HTTP requests to help you get started:

GET - Retrieve the homepage or main resource of a website to test connectivity and ensure the server is reachable and functioning:

Copy
GET https://example.com

GET - Test how the server responds to specific URL parameters:

Copy
POST /post HTTP/1.1
Host: postman-echo.com
Content-Type: application/json
Content-Length: 85
{
  "name": "Jane Doe",
  "email": "jane.doe@example.com",
  "role": "QA Engineer"
}

POST - To test how your server handles XML data, you can send a POST request with an XML body.

Copy
POST to "https://postman-echo.com/post" 
with header "Content-Type": "application/xml" 
and with header "Cookie": "sails.sid=s%3AdH-meujlxDXqBJhW0AkGOoElv4_7vNEo.B1GBTsmkNLbvmQoAryu%2Bk8CizA1A1G3zjuM%2F323YKG0" 
and with body "<note>
  <to>User</to>
  <from>Tester</from>
  <heading>Reminder</heading>
  <body>This is a test XML message.</body>
</note>"

POST - This test verifies that the server correctly accepts and processes JSON-formatted data sent with a Content-Type: application/json header. A successful response (e.g., 200 OK) confirms the server parsed the payload as expected.

Copy
POST /post HTTP/1.1
Host: postman-echo.com
Content-Type: application/json
Content-Length: 85
{
  "name": "Jane Doe",
  "email": "jane.doe@example.com",
  "role": "QA Engineer"
}

End-to-End Example

The following example runs an API GET command and asserts that the correct response is received:

Copy
1  Go to https://sandbox.applitools.com/e-commerce/contact-us                                                         
2  Type "Matt" in the "Your Name" field
3  Type "test@gmail.com" in the "Email" field
4  Select "Demo Request" from dropdown below "Contact Reason"
5  Click the "Submit" button
6  Requestid = text to the right of "use this id to track your request"
7  Get https://sandbox.applitools.com/api/get-contact-status?id={requestid} with header "accesskey: mysecretkey"
8  Assert that {response.body.data.status} equals "SUBMITTED"