コンテンツへスキップ

デバイス取得 GET ​

一意の識別子を指定して、特定のデバイスの詳細を取得します。

エンドポイント ​

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

認証 ​

必須

リクエストに次のいずれかのヘッダーを含めてください。

  • Token: <your-api-key> — API キーから取得できます
  • Authorization: Bearer <jwt-token> — ログインから取得できます

リクエスト ​

パスパラメーター ​

パラメーター型必須説明
tidstring✅デバイスの一意の識別子

ヘッダー ​

ヘッダー必須説明
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

デバイスオブジェクトを返します

フィールド型説明
tidstringデバイスの一意の識別子
namestringデバイス名
serial_numberstringデバイスのシリアル番号
is_activebooleanデバイスが有効かどうか
created_atstring登録日時
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見つかりません — デバイスが存在しません

Pocket Alert ドキュメント