# Update case note

### Description

This service allows an authenticated operator or party to update an existing comment (note) associated with a specific case.

***

### Request

#### Restrictions

* Authentication: Requires a successful operator or party login.
* Authorization: The request will fail if the authenticated user or touchpoint does not have permission to modify the specific case or the specific comment.
* Validation: The comment `id` provided in the body must belong to the `case_id` specified in the URL.

#### Endpoint

```
PUT https://<server-url>/api/v4/cases/{case_id}/notes
```

#### Path Parameters

| **Parameter** | **Type** | **Description**                                      |
| ------------- | -------- | ---------------------------------------------------- |
| `case_id`     | Integer  | The unique ID of the case that contains the comment. |

#### Parameters

| **Parameter**  | **Location**   | **Description**                                                                    |
| -------------- | -------------- | ---------------------------------------------------------------------------------- |
| `touchpoint`   | Query / Header | The identifier for the touchpoint. Use `Thalamus-Touchpoint` for the header.       |
| `token`        | Query / Header | The authentication token for the API session. Use `Thalamus-Token` for the header. |
| `Content-Type` | Header         | Must be `application/json`.                                                        |

#### Request Body

The body contains the ID of the specific comment to be modified and the new description.

| **Field**     | **Type**     | **Description**                                   |
| ------------- | ------------ | ------------------------------------------------- |
| `id`          | String / Int | Required. The unique ID of the comment to update. |
| `description` | String       | Required. The updated content of the note.        |

Example Body:

```
{  
   "id": "1",
   "description": "This is an updated note!" 
}
```

***

### Response

#### ✅ Successful Response: `201 Created`

The comment was successfully updated.

> Note: Although the method is `PUT`, the API returns a `201` status code in this implementation.

JSON

```
{  
   "context": {  
      "simpleProfile": {  
         "firstname": "test",
         "lastname": "test",
         "email": "test@test.com"
      }
   },
   "comment": {  
      "caseInstanceId": 1,
      "description": "This is an updated note!"
   }
}
```

***

### ❌ Unsuccessful Response

#### `400 Bad Request`

| **Error Code**         | **Description**                                                                                               |
| ---------------------- | ------------------------------------------------------------------------------------------------------------- |
| `invalidId`            | The `case_id` does not exist, or the authenticated operator/touchpoint is not authorized to access this case. |
| `comment`, `InvalidId` | The comment `id` provided in the body does not belong to the `case_id` specified in the path.                 |
