获取消息 GET
通过唯一标识符获取指定消息的详细信息。
端点
GET https://api.pocketalert.app/v1/messages/{tid}身份验证
请求
路径参数
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
tid | string | ✅ | 消息唯一标识符 |
请求头
| 请求头 | 必需 | 描述 |
|---|---|---|
Token | ✅ | 你的 API 密钥 |
Authorization | ✅ | Bearer <jwt-token> |
请求示例
bash
curl -X GET "https://api.pocketalert.app/v1/messages/jb4xw9elz24c5" \
-H "Token: your-api-key"javascript
const tid = 'jb4xw9elz24c5';
const response = await fetch(`https://api.pocketalert.app/v1/messages/${tid}`, {
headers: { 'Token': 'your-api-key' }
});
const message = await response.json();python
import requests
tid = 'jb4xw9elz24c5'
response = requests.get(
f'https://api.pocketalert.app/v1/messages/{tid}',
headers={'Token': 'your-api-key'}
)
print(response.json())php
$tid = 'jb4xw9elz24c5';
$response = Http::withHeaders([
'Token' => 'your-api-key',
])->get('https://api.pocketalert.app/v1/messages/'.$tid);
return $response->json();响应
成功响应
200 OK
返回消息对象
| 字段 | 类型 | 描述 |
|---|---|---|
tid | string | 消息唯一标识符 |
title | string | 消息标题 |
message | string | 消息正文 |
application | string | 应用名称 |
device | string | 目标设备 |
is_read | boolean | 消息是否已读 |
created_at | string | 创建时间戳 |
json
{
"tid": "jb4xw9elz24c5",
"title": "Server Alert",
"message": "CPU usage exceeded 90%",
"application": "Monitoring",
"device": "iPhone",
"is_read": true,
"created_at": "18.09.2023 17:35:35"
}错误响应
| 状态码 | 描述 |
|---|---|
401 | 未授权 — 令牌无效或缺失 |
404 | 未找到 — 消息不存在 |