コンテンツへスキップ

デバイス一覧を取得 GET ​

アカウントに登録されているすべてのデバイスの一覧を取得します。

エンドポイント ​

GET https://api.pocketalert.app/v1/devices

認証 ​

必須

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

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

リクエスト ​

ヘッダー ​

ヘッダー必須説明
Token✅API キー
Authorization✅Bearer <jwt-token>

リクエスト例 ​

bash
curl -X GET "https://api.pocketalert.app/v1/devices" \
  -H "Token: your-api-key"
javascript
const response = await fetch('https://api.pocketalert.app/v1/devices', {
  headers: { 'Token': 'your-api-key' }
});

const devices = await response.json();
python
import requests

response = requests.get(
    'https://api.pocketalert.app/v1/devices',
    headers={'Token': 'your-api-key'}
)
print(response.json())
php
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->get('https://api.pocketalert.app/v1/devices');

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"
  },
  {
    "tid": "qjxozlq7xr7fakrjplj193",
    "name": "Android Tablet",
    "serial_number": "GP2A.2891092711.017",
    "is_active": true,
    "created_at": "07.06.2023 22:44:47"
  }
]

エラー時のレスポンス ​

ステータス説明
401認証エラー — トークンが無効または未指定です

Pocket Alert ドキュメント