メッセージを更新 PUT
既存のメッセージの内容や既読状態を更新します。
エンドポイント
PUT https://api.pocketalert.app/v1/messages/{tid}認証
必須
リクエストに次のいずれかのヘッダーを含めてください:
リクエスト
パスパラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
tid | string | ✅ | メッセージの一意の識別子 |
ヘッダー
| ヘッダー | 必須 | 説明 |
|---|---|---|
Token | ✅ | API キー |
Authorization | ✅ | Bearer <jwt-token> |
ボディパラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
title | string | ✅ | メッセージのタイトル |
message | string | ✅ | メッセージの本文 |
application_id | string | ❌ | アプリケーションの TID |
device_id | string | ❌ | デバイスの TID |
is_read | boolean | ❌ | 既読/未読を設定 |
リクエスト例
bash
curl -X PUT "https://api.pocketalert.app/v1/messages/jb4xw9elz24c5" \
-H "Token: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Title",
"message": "Updated message content",
"is_read": true
}'javascript
const tid = 'jb4xw9elz24c5';
const response = await fetch(`https://api.pocketalert.app/v1/messages/${tid}`, {
method: 'PUT',
headers: {
'Token': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Updated Title',
message: 'Updated message content',
is_read: true
})
});python
import requests
tid = 'jb4xw9elz24c5'
response = requests.put(
f'https://api.pocketalert.app/v1/messages/{tid}',
headers={'Token': 'your-api-key'},
json={
'title': 'Updated Title',
'message': 'Updated message content',
'is_read': True
}
)
print(response.json())php
$tid = 'jb4xw9elz24c5';
$response = Http::withHeaders([
'Token' => 'your-api-key',
])->put('https://api.pocketalert.app/v1/messages/'.$tid, [
'title' => 'Updated Title',
'message' => 'Updated message content',
'is_read' => true,
]);
return $response->json();レスポンス
成功時のレスポンス
200 OK
メッセージの更新に成功しました
json
{
"data": "success"
}エラーレスポンス
| ステータス | 説明 |
|---|---|
401 | 認証エラー — トークンが無効または未指定です |
404 | Not Found — メッセージが存在しません |
400 | Bad Request — リクエストボディが不正です |