デバイス取得 GET
一意の識別子を指定して、特定のデバイスの詳細を取得します。
エンドポイント
GET https://api.pocketalert.app/v1/devices/{tid}認証
必須
リクエストに次のいずれかのヘッダーを含めてください。
リクエスト
パスパラメーター
| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
tid | string | ✅ | デバイスの一意の識別子 |
ヘッダー
| ヘッダー | 必須 | 説明 |
|---|---|---|
Token | ✅ | API キー |
Authorization | ✅ | Bearer <jwt-token> |
リクエストの例
bash
curl -X GET "https://api.pocketalert.app/v1/devices/9dc24hqldvv2bfx2nlc6r" \
-H "Token: your-api-key"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
import requests
tid = '9dc24hqldvv2bfx2nlc6r'
response = requests.get(
f'https://api.pocketalert.app/v1/devices/{tid}',
headers={'Token': 'your-api-key'}
)
print(response.json())php
$tid = '9dc24hqldvv2bfx2nlc6r';
$response = Http::withHeaders([
'Token' => 'your-api-key',
])->get('https://api.pocketalert.app/v1/devices/'.$tid);
return $response->json();レスポンス
成功時のレスポンス
200 OK
デバイスオブジェクトを返します
| フィールド | 型 | 説明 |
|---|---|---|
tid | string | デバイスの一意の識別子 |
name | string | デバイス名 |
serial_number | string | デバイスのシリアル番号 |
is_active | boolean | デバイスが有効かどうか |
created_at | string | 登録日時 |
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"
}エラーレスポンス
| ステータス | 説明 |
|---|---|
401 | 認証されていません — トークンが無効または未指定です |
404 | 見つかりません — デバイスが存在しません |