获取所有设备 GET
获取你账户下已注册的所有设备列表。
端点
GET https://api.pocketalert.app/v1/devices身份验证
请求
请求头
| 请求头 | 必填 | 说明 |
|---|---|---|
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
返回设备对象数组
| 字段 | 类型 | 说明 |
|---|---|---|
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"
},
{
"tid": "qjxozlq7xr7fakrjplj193",
"name": "Android Tablet",
"serial_number": "GP2A.2891092711.017",
"is_active": true,
"created_at": "07.06.2023 22:44:47"
}
]错误响应
| 状态码 | 说明 |
|---|---|
401 | 未授权,令牌无效或缺失 |