Update Message PUT
Perbarui konten atau status baca sebuah pesan.
Endpoint
PUT https://api.pocketalert.app/v1/messages/{tid}Autentikasi
Wajib
Sertakan salah satu header berikut dalam permintaan Anda:
Permintaan
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tid | string | ✅ | Pengenal unik pesan |
Headers
| Header | Required | Description |
|---|---|---|
Token | ✅ | Kunci API Anda |
Authorization | ✅ | Bearer <jwt-token> |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | ✅ | Judul pesan |
message | string | ✅ | Isi teks pesan |
application_id | string | ❌ | TID aplikasi |
device_id | string | ❌ | TID perangkat |
is_read | boolean | ❌ | Tandai sudah/belum dibaca |
Contoh Permintaan
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();Respons
Respons Sukses
200 OK
Pesan berhasil diperbarui
json
{
"data": "success"
}Respons Error
| Status | Description |
|---|---|
401 | Unauthorized — Token tidak valid atau tidak ada |
404 | Not Found — Pesan tidak ditemukan |
400 | Bad Request — isi permintaan tidak valid |