Skip to content
Get Free Trial

Build a Request

Set the method, URL, parameters, body, headers, authorization and settings of a REST request, import one, or reuse one from History.

A request is built on the Request tab of the REST Client. To add it to a keyword, open the REST Client from Add Step (see Add a REST Step to a Keyword).

The REST Client opened from Add Step, with a GET request to https://dummyjson.com/products?limit=3 on the Parameters tab, the response below it in the Tree view, and the Add Rest Step button at the bottom

Choose the method and enter the URL. The methods are GET, POST, PUT, DELETE, PATCH and QUERY.

Add query parameters as Key and Value rows. They’re sent in the URL’s query string.

Choose how to enter the body:

  • Raw: type the body as it should be sent, such as JSON or XML.
  • Parameters: enter form fields as key and value rows.

Add request headers as Key and Value rows, such as Content-Type.

Choose how the request authenticates: No Auth, Basic Auth, OAuth 1.0 or OAuth 2.0. See Authorization.

Reset Cookies (Yes or No) sets whether the request’s cookies are reset before it’s sent.

To test a file upload, send the file the way a browser’s upload form does:

  1. Choose POST and enter the upload URL. It’s usually the action URL of the upload form, or the URL the page sends the upload to. For example: https://sahitest.com/demo/php/fileUpload.php.

  2. Under Header, add Content-Type with the value multipart/form-data; boundary=--boundary123456abcd. The boundary is any random string that starts with two hyphens.

  3. Under Body, choose Parameters, add the file field, and choose the file with the browse button beside it, or type its full path:

    OS Example path
    Windows C:\Users\user\Desktop\upload.txt
    macOS /Users/user/Desktop/upload.txt
    Linux /home/user/Desktop/upload.txt
  4. Add any other fields the upload form needs.

  5. Click Send Request. The response depends on the application, such as a page confirming the upload.

Instead of building a request by hand, click Import Request and choose Import from HAR or Import from Postman.

The REST Client with the Import Request menu open and highlighted, showing Import from HAR and Import from Postman, and the Add Rest Step button at the bottom

A HAR file records the requests a browser makes. To get one, open the browser’s developer tools, go to Network, right-click the requests and choose Save all as HAR (the wording varies by browser).

  1. Choose Import Request › Import from HAR.
  2. Paste the request section of the request you want, and click Import. It must be valid JSON, with its opening and closing braces; otherwise an alert says so.

A request section looks like this:

{
"request": {
"method": "GET",
"url": "https://sahitest.com/demo/",
"httpVersion": "HTTP/1.1",
"headers": [
{ "name": "Host", "value": "sahitest.com" },
{ "name": "Connection", "value": "keep-alive" },
{ "name": "Cache-Control", "value": "max-age=0" }
],
"queryString": [],
"cookies": [],
"headersSize": 585,
"bodySize": 0
}
}

A test can record the requests the application makes while it runs, so you can turn one of them into a REST step:

  1. Wrap the steps with _startHarLogging and _stopHarLogging, and run the test.
  2. In the test run report, click Show Network Activity.
  3. Click Copy HAR on the request you want, then paste it into Import from HAR as above.

History keeps the requests you’ve sent, so you can open one again and reuse it.