# RequestStep

A **RequestStep** node is used for sending HTTP requests. TestMace allows to configure a request and use it as a single request or as a part of a scenario.

### A RequestStep node in the project tree

To create a **RequestStep** node right-click on a  [Folder](https://docs.testmace.com/node-types/folder) or [Project](https://docs.testmace.com/node-types/project) node and choose **Add node -> RequestStep**.

This is how a **RequestStep** node looks like in the project tree:

![A RequestStep node in the project tree](https://1550208191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-LlfdO6jxRXXJvT27opm%2F-LlfdY5N7y3_Ejz_7yjg%2Fimage.png?alt=media\&token=06f38d34-f9c9-44f7-925a-0c4671c252a8)

Let's discuss its features in more detail. The color of the top left circle signifies an HTTP request status: gray - if the request hasn't been sent yet, green - if the HTTP code is successful (e. g. 200, 201, etc), red - if the HTTP code is unsuccessful (e. g. 404, 500, etc). The sheet icon color signifies a child [Assertion](https://docs.testmace.com/node-types/assertion-node) node status: gray - if the node hasn't been run yet, green - if after running the [Assertion](https://docs.testmace.com/node-types/assertion-node) node either doesn't exist or was successfully run, red - if the [Assertion](https://docs.testmace.com/node-types/assertion-node) node was run unsuccessfully (some tests were failed).

There are several actions you can do with this node type:

![Context menu for the RequestStep node](https://1550208191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-LlfdO6jxRXXJvT27opm%2F-LlfdnSjXlQrJrODLKd4%2Fimage.png?alt=media\&token=0312686c-e434-4330-933a-ccee2808f7ae)

* **Add node.** Click on it to add a child node. You can choose a node type in the submenu.
* **Rename.** Change the node name.
* **Duplicate.** Make a copy of the node. The new node will be named *NodeName \[Copy \[number]]*.
* **Remove node.** Use it to delete the node.
* **Run.** Run the node.
* [**Share**](https://docs.testmace.com/other-features/import/shared) the node. Note that the link with information about the node will be created in the clipboard.
* **Show in explorer.** Open the folder with the node in the file manager.

**RequestStep Node Tab**

After you create a **RequestStep** node (or double click on it) you'll see the RequestStep node tab. It looks like this:

![The RequestStep node tab](https://1550208191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-LhEe9KoXsq-0TMyMIKr%2F-LhEeFBacAIdCWd1c1LG%2F7.png?alt=media\&token=809e17f4-78b8-4ff7-a4b9-d821a341480f)

Let's discuss every interface part in detail.

#### Request Configuration Area

The top area of the tab looks like this:

![The top area of the tab](https://1550208191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-Lgl2bpuFMbqWPyxebVZ%2F-Lgg6pFo1MUmwO3TlI2e%2F3.png?alt=media\&token=9e9d18da-7c42-4d7a-ba13-4af46bdfa203)

In the screenshot you can see the following parts of the tab:

1. Request method. There are several methods you can choose from:
   * **GET** — get a resource
   * **POST** — create a resource
   * **PUT** — update a resource
   * **DELETE** — delete a resource
   * **PATCH** — make some changes to a resource
   * **OPTIONS** — specify resource connection parameters
2. The URL field.
3. The Run button.
4. The button for [editing variables](https://app.gitbook.com/@testmace/s/project/~/drafts/-Ljtp7mh1Q7dEcGEFMwr/primary/variables/user-variables/staticheski-opredelyaemye-peremennye)

‌You can see the edit panel for headers, query parameters, authorization and request body down below. This is the panel for POST requests:

![Request parameters edit panel](https://1550208191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-LhEe9KoXsq-0TMyMIKr%2F-LhEeSfnbk-XB_Cp-SYq%2F8.png?alt=media\&token=58f36e77-d1ad-471e-a749-148d9c81bbf1)

The panel has the following tabs:

* **Headers** - edits an HTTP headers list;
* **Query parameters** - edits a query parameters list;
* **Body** - configures a request body;
* **Authorization** - configures [authorizations](https://docs.testmace.com/working-with-project/authorization);
* **Other** - configures other request parameters.

The **Headers** and **Query** parameters tabs have similar interfaces - they are both tables with [bulk editing](https://docs.testmace.com/other-features/bulk-edit) and row disabling options. Moreover, HTTP headers can be set [by default](https://docs.testmace.com/other-features/default-http-headers).

The **Other** tab has the following interface:

![](https://1550208191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-LholopcaA6HBvjCALCd%2F-LholrtdZoWLvhle3Aqt%2Fother_RS.jpg?alt=media\&token=61b0ab6c-d788-4bd4-a296-4d3c905a7f9e)

You can set the **Requires SSL certificates be valid** parameter. It is **Inherit** by default, which means that the value of the parent node is inherited. If this parameter of the parent node is **Inherit**, the parameter is disabled. You can choose from:

* Yes
* No
* Inherit

Now look at the **Body** tab:

![The Body tab](https://1550208191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-LhEfGEQf9EJ_mvdBLUe%2F-LhEfIwPsMSA3HRokWb5%2F10.png?alt=media\&token=6fc44bf9-a1af-48f8-ba8a-c58ea0d4621e)

You can choose your body type from a dropdown menu:

* **JSON** - to send JSON data. You can use the editor with JSON syntax highlighting and the [variables mechanism](https://docs.testmace.com/variables/user-variables) support to edit the data. When sending a request a `Content-Type`  header with the `application/json`

  value is added to the HTTP headers list.
* **Form data** - to edit `multipart/form-data` forms. It is a table with [bulk edit ](https://docs.testmace.com/other-features/bulk-edit)option. The table rows may contain either plain strings or file links as their values.
* **Form URL encoded** - to edit `application/x-www-form-urlencoded` forms. It is a table with [bulk edit ](https://docs.testmace.com/other-features/bulk-edit)option.
* **File** - to send a file content in the request body.
* **XML** - to send XML data. You can use the editor with XML syntax highlighting and the [variables mechanism](https://docs.testmace.com/variables/user-variables) support to edit the data. When sending a request a `Content-Type` header with `application/xml` value is added to the HTTP headers list.
* **Text** - to send text data. You can use the editor with the [variables mechanism](https://docs.testmace.com/variables/user-variables) support to edit the data. When sending a request a `Content-Type` header with `text/plain` value is added to the HTTP headers list.

**Response Configuration Area**

Let's send a request to the <https://testmace-stage.herokuapp.com/posts> url and look at the response area:

![The RequestStep node response area](https://1550208191-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYfhIaTTw23Sf3L5jfe%2F-Lgl2bpuFMbqWPyxebVZ%2F-Lgl8De35KiGku03AgVu%2F6.png?alt=media\&token=3d716437-3fbe-4d07-bd08-338ee1dd8c12)

You can see short info about the response at the top of the area: a successful or unsuccessful response code, time and size.

There are the following tabs at the bottom of the response area:

* **Response body** - contains the response body in different formats, such as:
  * **Parsed** - a tree form of the response. Each tree element has a context menu, so that you could create [Assertion](https://docs.testmace.com/node-types/assertion-node) nodes and work with [dynamic variables](https://docs.testmace.com/variables/user-variables/dynamic-variables#variable-assignment).
  * **JSON** - JSON syntax highlighting of the response body. It is available only if you have a JSON response body.
  * **XML** - XML syntax highlighting of the response body. It is available only if you have an XML response body.
  * **HTML** - HTML syntax highlighting of the response body. It is shown if the response body is an HTML page.
  * **Text** - plain text with no highlighting.
  * **Preview** - a rendered response body version. It is shown if the response body is an HTML page.
* **Response headers** - a response HTTP headers list.
* **Assertions** - a list of assertions that a child [Assertion](https://docs.testmace.com/node-types/assertion-node) node has.

**File Representation**

A **RequestStep** node is a folder with the node name, containing the index.yml file with the following format:

```javascript
{
  "type": "object",
  "properties": {
    "type": {
      "description": "Type of Folder node",
      "const": "RequestStep",
      "type": "string"
    },
    "assignVariables": {
      "description": "List of variables assignments",
      "type": "array",
      "items": {
        "$ref": "#/definitions/AssignVariable"
      },
      "default": []
    },
    "requestData": {
      "$ref": "#/definitions/IRequestData"
    },
    "authData": {
      "$ref": "#/definitions/IAuthorizationData",
      "description": "Authorization parameters"
    },
    "children": {
      "description": "List of children names",
      "type": "array",
      "items": {
        "type": "string"
      },
      "default": []
    },
    "variables": {
      "$ref": "#/definitions/NodeVariables",
      "description": "Node variables dictionary"
    },
    "name": {
      "description": "Node name",
      "type": "string"
    }
  },
  "required": [
    "assignVariables",
    "authData",
    "children",
    "name",
    "requestData",
    "type",
    "variables"
  ],
  "definitions": {
    "AssignVariable": {
      "type": "object",
      "properties": {
        "path": {
          "description": "Path in $response variable (e.g. body.id)",
          "type": "string"
        },
        "assign": {
          "$ref": "#/definitions/NodeReference",
          "description": "Link on target node (one of parents)"
        },
        "variable": {
          "description": "Name of dynamic variable in target node",
          "type": "string"
        }
      },
      "required": [
        "assign",
        "path",
        "variable"
      ]
    },
    "NodeReference": {
      "type": "object",
      "properties": {
        "refNodePath": {
          "description": "Absolute path to node",
          "type": "string"
        },
        "type": {
          "description": "Marker of reference entity",
          "const": "reference",
          "type": "string",
          "default": "reference"
        }
      },
      "required": [
        "refNodePath",
        "type"
      ]
    },
    "IRequestData": {
      "type": "object",
      "properties": {
        "request": {
          "description": "Common request parameters",
          "type": "object",
          "properties": {
            "method": {
              "$ref": "#/definitions/RequestMethod",
              "description": "HTTP-method"
            },
            "url": {
              "type": "string"
            }
          },
          "required": [
            "method",
            "url"
          ]
        },
        "params": {
          "description": "Query parameters",
          "type": "array",
          "items": {
            "$ref": "#/definitions/NameValueParam"
          }
        },
        "body": {
          "$ref": "#/definitions/IRequestBody",
          "description": "Body parameters"
        },
        "headers": {
          "description": "Headers",
          "type": "array",
          "items": {
            "$ref": "#/definitions/NameValueParam"
          }
        },
        "disabledInheritedHeaders": {
          "description": "Names of disabled headers",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "strictSSL": {
          "$ref": "#/definitions/StrictSSLOptions",
          "description": "Requires SSL certificates be valid"
        }
      },
      "required": [
        "body",
        "disabledInheritedHeaders",
        "headers",
        "params",
        "request",
        "strictSSL"
      ]
    },
    "RequestMethod": {
      "enum": [
        "DELETE",
        "GET",
        "OPTIONS",
        "PATCH",
        "POST",
        "PUT"
      ],
      "type": "string"
    },
    "NameValueParam": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        },
        "isChecked": {
          "type": "boolean"
        }
      },
      "required": [
        "name",
        "value"
      ]
    },
    "IRequestBody": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/definitions/RequestBodyType",
          "description": "Type of body"
        },
        "jsonBody": {
          "description": "JSON string of body",
          "type": "string"
        },
        "xmlBody": {
          "description": "XML string of body",
          "type": "string"
        },
        "textBody": {
          "type": "string"
        },
        "formData": {
          "description": "multipart/form-data form",
          "type": "array",
          "items": {
            "$ref": "#/definitions/RequestStepFormData"
          }
        },
        "formURLEncoded": {
          "description": "application/x-www-form-urlencoded form",
          "type": "array",
          "items": {
            "$ref": "#/definitions/NameValueParam"
          }
        },
        "file": {
          "description": "Link on file, which will be used as a content for body",
          "type": "string"
        }
      },
      "required": [
        "file",
        "formData",
        "formURLEncoded",
        "jsonBody",
        "textBody",
        "type",
        "xmlBody"
      ]
    },
    "RequestBodyType": {
      "enum": [
        "File",
        "FormData",
        "FormURLEncoded",
        "Json",
        "Text",
        "Xml"
      ],
      "type": "string"
    },
    "RequestStepFormData": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/definitions/FormDataField"
        },
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        },
        "isChecked": {
          "type": "boolean"
        }
      },
      "required": [
        "name",
        "type",
        "value"
      ]
    },
    "FormDataField": {
      "enum": [
        "File",
        "Text"
      ],
      "type": "string"
    },
    "StrictSSLOptions": {
      "enum": [
        "Inherit",
        "No",
        "Yes"
      ],
      "type": "string"
    },
    "IAuthorizationData": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    },
    "NodeVariables": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.testmace.com/node-types/request-step.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
