Updated on 2023-03-14 GMT+08:00

Setting an API Request

Request URL and URL Parameters

On the Scripting tab page of the API automation test cases, enter the URL to be requested. HTTP and HTTPS requests are supported.

API automation supports the following URL request modes. By default, the request mode of a new URL is GET.

Request Mode



Retrieves data from APIs.


Uploads files and adds data.


Replaces the existing data.


Deletes the existing data.


Obtains the HTTP header of a response.


Pre-checks requests.


Updates the fields of some existing data.

The request URL supports environment parameters, local parameters, and response extraction parameters. For details, see Setting Test Case Parameters.

Request Header

Common HTTP request headers are preset for API automation. In the request header module, enter the request header information.

The request header can be in a form or text. By default, the form mode is used on the page. You can click to switch between the form and text modes.

  • Form: Select or enter a request header name in the Name column, and select or enter a value in the Value column.

  • Text: The request header must be in the format of key:value.

    Unlike the form mode, the text mode supports only the configuration of Request Header and Value, but not Description.

    Pay attention to the following restrictions when setting request headers:

    1. The total number of request headers cannot exceed 30.
    2. The length of the request header cannot exceed 10000.

Multiple common HTTP request headers are preset in CodeArts TestPlan. For details, see the following table.

Request Header



Acceptable response content type (Content-Types), for example, text/plain.


Acceptable character set, for example, UTF-8.


List of acceptable encoding modes, for example, compress | gzip | identity.


Natural language list of acceptable response content, for example, en-US.


Acceptable versions displayed by time.


Pre-checks requests so that the server knows which HTTP methods will be used when the actual requests are sent.


Pre-checks requests so that the server knows which HTTP headers will be used when the actual requests are sent.


Information used for HTTP authentication.


Instructions that must be followed by all cache mechanisms for a request or response chain.


Preferred connection type used by the browser.


HTTP cookie sent by servers through the Set-Cookie.


Length of the request body represented by 8-byte arrays.


Binary MD5 hash value of the content of the request body, which is encoded using Base64.


Multimedia types of the request body (used in POST and PUT requests), for example, application/json.


Date and time when a message is sent.


Specific actions required by a client for a server.


Client-oriented information from the path proxy server that the proxy participates in the request when it is changed or lost.

It is used for debugging, collecting statistics on, and generating location-dependent content, and is designed to display privacy-sensitive information, such as the IP address of the client. Therefore, pay attention to user privacy when deploying this header.


Email address of the user who initiates the request.


Domain name of the server (used for the virtual host) and the port number of the transmission control protocol listened to by the server. If the requested port is the standard port of the corresponding service, the port number can be omitted.

This field is mandatory since HTTP/1.1. If the domain name in the URL is an IP address, this field is automatically added. Otherwise, enter the IP address and port number of the tested application in this field.


The corresponding operation is performed only when the entity provided by the client matches the entity on the server. It is used in a method such as PUT to update a resource which has not been modified since the last update.


Return 304 Not Modified is allowed when the corresponding content is not modified.


Return 304 Not Modified is allowed when the corresponding content is not modified. Refer to the HTTP entity tag.

In a typical use, when a URL is requested, the web server returns the resource and its corresponding ETag value, which is placed in the ETag field of the HTTP. The client can then decide whether to cache the resource and its ETag. If the client requests the same URL in the future, a request containing the saved ETag and the If-None-Match field is sent.


If an entity is not modified, one or more parts that are missing are sent to the sender. Otherwise, the entire new entity is sent.


A response is sent only when the entity has not been modified since a specific time.


Number of times a message can be forwarded by the proxy and gateway.


Initiates a request for cross-origin resource sharing. The server is mandatory to add an Access-Control-Allow-Origin field to the response.


Related to specific implementations and may produce multiple effects at any time in the request or response chain.


Information used to authenticate a proxy.


Requests only a part of an entity with the byte offset starting from 0.


Previous page accessed by a browser. A link on this page brings the browser to the currently requested page.


Transmission coding mode expected by a browser. You can use a value of Transfer-Encoding in the response protocol header. In addition, the value trailers (related to the block transmission mode) indicates that the browser expects to receive additional fields if the size of the last block is 0.


String of the browser identity.


Asks the server to be upgraded to another protocol.


Request-sending agents informed to the server.


General warning indicating that errors may exist in the body of an entity.

Request Body

A request body is a message (packet) to be transferred in an API request. The request body can be in text, JSON, or form format.

If the request mode is POST, PUT, DELETE, OPTIONS, or PATCH, the request body is displayed on the page. If the request mode is GET or HEAD, the request body is not displayed.

  • Text: You can enter a standard JSON string. The method is the same as that for selecting a JSON request body.

  • Form: The text and file types are supported.
    • Text: Set the parameter name and value.

    • File: Set the parameter name and assign a value to the parameter by uploading a file in any format.