# 메시지 업데이트 (PUT)

기존 메시지의 내용이나 읽음 상태를 업데이트합니다.

## 엔드포인트

```
PUT https://api.pocketalert.app/v1/messages/{tid}
```

## 인증

> **Info: 필수**
>
> 요청에 다음 헤더 중 하나를 포함하세요:
> - `Token: <your-api-key>` — [API 키](https://pocketalert.app/account/apikeys)에서 발급받을 수 있습니다
> - `Authorization: Bearer <jwt-token>` — [로그인](https://info.pocketalert.app/api/user/login.md)에서 발급받을 수 있습니다

## 요청

### 경로 매개변수

| 매개변수 | 타입 | 필수 | 설명 |
|-----------|------|:--------:|-------------|
| `tid` | string | ✅ | 메시지 고유 식별자 |

### 헤더

| 헤더 | 필수 | 설명 |
|--------|:--------:|-------------|
| `Token` | ✅ | API 키 |
| `Authorization` | ✅ | `Bearer <jwt-token>` |

### 본문 매개변수

| 매개변수 | 타입 | 필수 | 설명 |
|-----------|------|:--------:|-------------|
| `title` | string | ✅ | 메시지 제목 |
| `message` | string | ✅ | 메시지 본문 텍스트 |
| `application_id` | string | ❌ | 애플리케이션 TID |
| `device_id` | string | ❌ | 기기 TID |
| `is_read` | boolean | ❌ | 읽음/안 읽음 표시 |

### 요청 예시

**cURL**

```bash
curl -X PUT "https://api.pocketalert.app/v1/messages/jb4xw9elz24c5" \
  -H "Token: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated Title",
    "message": "Updated message content",
    "is_read": true
  }'
```

**JavaScript**

```javascript
const tid = 'jb4xw9elz24c5';
const response = await fetch(`https://api.pocketalert.app/v1/messages/${tid}`, {
  method: 'PUT',
  headers: {
    'Token': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'Updated Title',
    message: 'Updated message content',
    is_read: true
  })
});
```

**Python**

```python
import requests

tid = 'jb4xw9elz24c5'
response = requests.put(
    f'https://api.pocketalert.app/v1/messages/{tid}',
    headers={'Token': 'your-api-key'},
    json={
        'title': 'Updated Title',
        'message': 'Updated message content',
        'is_read': True
    }
)
print(response.json())
```

**PHP**

```php
$tid = 'jb4xw9elz24c5';
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->put('https://api.pocketalert.app/v1/messages/'.$tid, [
    'title' => 'Updated Title',
    'message' => 'Updated message content',
    'is_read' => true,
]);

return $response->json();
```

## 응답

### 성공 응답

> **Tip: 200 OK**
>
> 메시지가 성공적으로 업데이트되었습니다

```json
{
  "data": "success"
}
```

### 오류 응답

| 상태 | 설명 |
|:------:|-------------|
| `401` | 인증 실패 — 토큰이 잘못되었거나 없습니다 |
| `404` | 찾을 수 없음 — 메시지가 존재하지 않습니다 |
| `400` | 잘못된 요청 — 요청 본문이 올바르지 않습니다 |
