Skip to main content

RESTful Request

Katalon Studio supports sending RESTful requests with parameters, body data, and authorization details needed. When sending a request, you can receive a response from the API server for examination and troubleshooting.

This page guides you on how to create and configure a RESTful request in Katalon Studio.

Create a RESTful request

  1. In the Tests Explorer panel, select Object Repository > New > Web Service Request.
  2. In the New Web Service Request dialog, give the request a name, select RESTful for the Request Type; and set the request URL.
    Create a new web service request

  3. Click OK.
You have a newly created RESTful request. Go to the next section to learn about the components of a RESTful request.

Configure RESTful request

After you have created a request successfully, double-click on the request to open it in the editor view.

Request methods and URL

Request method

The request method indicates the expected action to be executed on the specified resource. Katalon Studio supports the following RESTful request methods: GET, POST, PUT, DELETE, PATCH, HEAD, CONNECT, OPTIONS, and TRACE. The method needs to match the API endpoint to be a valid request. You can refer to REST API Tutorial for more details on each method: HTTP Methods.

By default, a newly created RESTful request uses the GET method. Click the drop-down menu next to GET to select a different method.

For KSE users, you can add custom method to the project by clicking Customize API methods to open the Project Settings dialog, then click Add.

Request URL

Request URL is to tell the web server which API is utilized under test. Any mismatch between method and URL leads to an invalid request exception at runtime or a wrong data response. You need to specify a URL indicating the service endpoint of each request. For example, the URLhttps://petstore.swagger.io/v2/pet/findByStatus?status=${status}is registered for the RESTful request we've created. In URLs, you can use variables to update the Query Parameters table flexibly.

Query parameters

This table displays any parameter to be passed along with the RESTful request object. These values are generated automatically based on the Request URL or can be manually added. Katalon Studio encodes special characters in query parameters before sending requests.

To learn more about Query Parameters, see: Parameterize a Web Service Object.

Authorization tab

By default, a newly created RESTful request is set at No Authorization. You can select from the supported authorization types to verify if the client is permitted to send the request, and to perform the endpoint operation.

For more details on using each type of authorization, see:

Request Header tab

You can configure the header information needed for sending the RESTful request object. By default, the Content-Type value is generated automatically based on the HTTP Body. You can also select headers from the list of suggested options (by double-clicking on the Name cell) or enter another header. Refer to Supported HTTP Headers for more details.

Request Body tab

By default, Katalon Studio selects none for HTTP body. If you need to send a body with your request, choose among these data types: text, x-www-form-urlencoded, form-data, file, and GraphQL.

  • Text: With this type, the supported formats include Text, JSON, XML, HTML, and Javascript. You can check Auto update Content Type to automatically generate a HTTP header.

  • x-www-form-urlencoded: Enter your key-value pairs accordingly to the Name and Value columns to encode with the request before sending.

  • Form-data: This data type allows you to send data to APIs as multipart/form-data, and attach files to your request. You can specify the content type in the form-data body.

  • file: Select the file you want to send with the request.

  • GraphQL: Enter your code in the Query pane and any variables in the Query Variables pane.

Validation tab

You can validate against schemas to assert whether a request or a response follows the associated schema definition and make sure that APIs are working as expected. For more details, refer to Validate against a schema in the web service request.

Verifications tab

You can write verification scripts directly in the Verification tab of the web service object. To learn more about the verification snippets, you can refer to this document: Verification snippets.

Variables tab

To pass the variables value to the POST request, specify variables in the Variables tab.

Configuration

The Follow redirects allows you to automatically make a new request when the server responds with a 3xx status. You can disable this option to prevent automatically redirecting such requests that return a 3xx series response, you can examine and manage the redirection manually.

Response

After you send a request, Katalon Studio supports reading its response in the Response tab. A service response comprises Status, Elapsed time, and Size fields; Body section, Header, and Verification Log.

  • Status: The status code of the response
  • Elapsed: The total time that starts from the request is sent until Katalon Studio receives the last byte of the response
  • Size: Size of the response package



Response body

Katalon can read a service response in JSON, XML, HTML, and JavaScript. The response body can be displayed in three formats: pretty, raw, and preview.

  • pretty: Response is displayed in a pretty format which is easier to read

  • raw: Response is displayed in the raw text without any format

  • preview: Response is displayed as visualized (for example, if a Response is from loading a specific webpage, it is displayed as the screenshot below)

Response header

The response's header is displayed in the Header tab:

Verification log

This tab displays the verification results after the request is tested and verified.