# UpdateTestcase

## Parameters

The following URL, Headers and Parameters are required for requests to this API endpoint. Where a parameter is optional, it will be indicated. Otherwise treat all parameters as mandatory.

### Headers

```
PUT /api/ss/project/:projectId/testcase/:testcaseId HTTP/1.1
Host: demo.attackforge.com
X-SSAPI-KEY: APIKey
Content-Type: application/json
Connection: close
```

### Query

**projectId (string)**

Id of the project.

Example:

```
PUT /api/ss/project/5e7c29afa3362408cf502a11/testcase/:testcaseId HTTP/1.1
```

**testcaseId (string)**

Id of the testcase.

Example:

```
PUT /api/ss/project/:projectId/testcase/5e7c29afa3362408cf502a18  HTTP/1.1
```

**testcase (string) (optional)**

Name of the test case. For example, "Test for XYZ".

Example:

```
{
   "testcase": "..."
}
```

**assigned\_to\_user (string) (optional)**

User Id to assign test case to.

Example:

```
{
   "assigned_to_user": "..."
}
```

**assigned\_to\_assets** **(array of strings) (optional)**

Project scope assets to assign test case to.

Example:

```
{
   "assigned_to_assets": ["..."]
}
```

**status (string) (optional)**

Status of the test case. Must match exactly one of the following: *Tested, Testing In Progress, Not Tested, Not Applicable*

Example:

```
{
   "status": "Tested"
}
```

**linked\_vulnerabilities (array of strings) (optional)**

Vulnerability Ids to link to test case.

Example:

```
{
   "linked_vulnerabilities": ["...", "...", "..."]
}
```

**code (string) (optional)**

Test case code.

Example:

```
{
   "code": "..."
}
```

**details (string) (optional)**

Test case details. Supports limited HTML for styling.

Example:

```
{
   "details": "<p>...</p>"
}
```

**execution\_flow (array of objects) (optional)**

Test case execution flow. Details supports limited HTML for styling.

Example:

```
{
   "execution_flow": [
      {
         "title": "...",
         "details": "<p>...</p>"
      }
   ]
}
```

**tags (array of strings) (optional)**

Test case tags.

Example:

```
{
   "tags": ["..."]
}
```

**sort\_order (integer) (optional)**

Sort order when viewing testing case in the user interface.

Example:

```
{
   "sort_order": 1
}
```

**project\_testcase\_custom\_fields (array of objects) (optional)**

Custom fields. Must include a key and value. Key must be unique and letters, number and underscores only.

For more information visit <https://support.attackforge.com/attackforge-enterprise/getting-started/custom-fields-and-forms#using-custom-fields-with-apis>

Example:

```
{   
    "custom_fields": [
        {
            "key": "...", 
            "value": "..."
        }
    ]
}
```

**testcase\_custom\_fields (array of objects) (optional)**

Custom fields. Must include a key and value. Key must be unique and letters, number and underscores only.

For more information visit <https://support.attackforge.com/attackforge-enterprise/getting-started/custom-fields-and-forms#using-custom-fields-with-apis>

Example:

```
{   
    "custom_fields": [
        {
            "key": "...", 
            "value": "..."
        }
    ]
}
```

## Example

The following example is a cURL request to update a testcase on a project.

### Request

Include API Token instead of stars in 'X-SSAPI-KEY: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*' parameter.

```
curl -X PUT 'https://demo.attackforge.com/api/ss/project/5e7c29afa3362408cf502a11/testcase/5e7c29afa3362408cf502a18' -H 'Host: demo.attackforge.com' -H 'X-SSAPI-KEY: ***************************************' -H 'Content-Type: application/json' -H 'Connection: close' -d '{
  "testcase": "Test for X, Y, Z.", 
  "assigned_to_user": "66719e71f74c0fa64d278cbd", 
  "assigned_to_assets": [
    "6683caedada7972c8c28f1b3"
  ], 
  "status": "Tested", 
  "linked_vulnerabilities": [
    "66849b77950ab45e68fc7b48"
  ], 
  "code": "12345",
  "details": "<b>some details...</b>",
  "execution_flow": [
    {
      "title": "Step 1",
      "details": "<b>some details...</b>"
    }
  ],
  "tags": [
    "tag1"
  ],
  "project_testcase_custom_fields": [
    {
      "key": "some_field",
      "value": "some value..."
    }
  ],
  "testcase_custom_fields": [
    {
      "key": "some_other_field",
      "value": "some other value..."
    }
  ]
}'
```

### Response

Response contains a status.

```
{
   "status": "Testcase Updated"
}
```


---

# 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://support.attackforge.com/attackforge-enterprise/modules/self-service-restful-api/updatetestcase.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.
