# Get Message (GET)

Ambil detail pesan tertentu berdasarkan identifier unik-nya.

## Endpoint

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

## Autentikasi

> **Info: Wajib**
>
> Sertakan salah satu header berikut dalam request Anda:
> - `Token: <your-api-key>` — Dapatkan dari [Kunci API](https://pocketalert.app/account/apikeys)
> - `Authorization: Bearer <jwt-token>` — Dari [Masuk](https://info.pocketalert.app/api/user/login.md)

## Request

### Path Parameters

| Parameter | Type | Required | Description |
|-----------|------|:--------:|-------------|
| `tid` | string | ✅ | Identifier unik pesan |

### Headers

| Header | Required | Description |
|--------|:--------:|-------------|
| `Token` | ✅ | Kunci API Anda |
| `Authorization` | ✅ | `Bearer <jwt-token>` |

### Contoh Request

**cURL**

```bash
curl -X GET "https://api.pocketalert.app/v1/messages/jb4xw9elz24c5" \
  -H "Token: your-api-key"
```

**JavaScript**

```javascript
const tid = 'jb4xw9elz24c5';
const response = await fetch(`https://api.pocketalert.app/v1/messages/${tid}`, {
  headers: { 'Token': 'your-api-key' }
});
const message = await response.json();
```

**Python**

```python
import requests

tid = 'jb4xw9elz24c5'
response = requests.get(
    f'https://api.pocketalert.app/v1/messages/{tid}',
    headers={'Token': 'your-api-key'}
)
print(response.json())
```

**PHP**

```php
$tid = 'jb4xw9elz24c5';
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->get('https://api.pocketalert.app/v1/messages/'.$tid);

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

## Response

### Success Response

> **Tip: 200 OK**
>
> Mengembalikan objek pesan

| Field | Type | Description |
|-------|------|-------------|
| `tid` | string | Identifier unik pesan |
| `title` | string | Judul pesan |
| `message` | string | Isi pesan |
| `application` | string | Nama aplikasi |
| `device` | string | Perangkat tujuan |
| `is_read` | boolean | Apakah pesan sudah dibaca |
| `created_at` | string | Timestamp pembuatan |

```json
{
  "tid": "jb4xw9elz24c5",
  "title": "Server Alert",
  "message": "CPU usage exceeded 90%",
  "application": "Monitoring",
  "device": "iPhone",
  "is_read": true,
  "created_at": "18.09.2023 17:35:35"
}
```

### Error Responses

| Status | Description |
|:------:|-------------|
| `401` | Unauthorized — Token tidak valid atau tidak ada |
| `404` | Not Found — Pesan tidak ada |
