# Get Device (GET)

Ambil detail perangkat tertentu menggunakan identifier unik-nya.

## Endpoint

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

## Autentikasi

> **Info: Wajib**
>
> Sertakan salah satu header berikut dalam permintaan 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)

## Permintaan

### Path Parameters

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

### Headers

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

### Contoh Permintaan

**cURL**

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

**JavaScript**

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

**Python**

```python
import requests

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

**PHP**

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

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

## Respons

### Respons Sukses

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

| Field | Type | Description |
|-------|------|-------------|
| `tid` | string | Identifier unik perangkat |
| `name` | string | Nama perangkat |
| `serial_number` | string | Nomor seri perangkat |
| `is_active` | boolean | Apakah perangkat aktif |
| `created_at` | string | Cap waktu registrasi |

```json
{
  "tid": "9dc24hqldvv2bfx2nlc6r",
  "name": "iPhone 15 Pro",
  "serial_number": "123456-OK91-KLAI-8K91-32A0AKSA28X2",
  "is_active": true,
  "created_at": "12.06.2023 02:48:49"
}
```

### Respons Error

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