Update Device PUT
Perbarui nama atau pengaturan perangkat.
Endpoint
PUT https://api.pocketalert.app/v1/devices/{tid}Autentikasi
Wajib
Sertakan salah satu header berikut dalam permintaan Anda:
Permintaan
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tid | string | ✅ | Pengenal unik perangkat |
Headers
| Header | Required | Description |
|---|---|---|
Token | ✅ | Kunci API Anda |
Authorization | ✅ | Bearer <jwt-token> |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | ✅ | Nama perangkat yang baru |
Contoh Permintaan
bash
curl -X PUT "https://api.pocketalert.app/v1/devices/9dc24hqldvv2bfx2nlc6r" \
-H "Token: your-api-key" \
-H "Content-Type: application/json" \
-d '{"name": "My iPhone"}'javascript
const tid = '9dc24hqldvv2bfx2nlc6r';
const response = await fetch(`https://api.pocketalert.app/v1/devices/${tid}`, {
method: 'PUT',
headers: {
'Token': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({ name: 'My iPhone' })
});python
import requests
tid = '9dc24hqldvv2bfx2nlc6r'
response = requests.put(
f'https://api.pocketalert.app/v1/devices/{tid}',
headers={'Token': 'your-api-key'},
json={'name': 'My iPhone'}
)
print(response.json())php
$tid = '9dc24hqldvv2bfx2nlc6r';
$response = Http::withHeaders([
'Token' => 'your-api-key',
])->put('https://api.pocketalert.app/v1/devices/'.$tid, [
'name' => 'My iPhone',
]);
return $response->json();Respons
Respons Sukses
200 OK
Perangkat berhasil diperbarui
json
{
"data": "success"
}Respons Error
| Status | Description |
|---|---|
401 | Unauthorized — Token tidak valid atau tidak ada |
404 | Not Found — Perangkat tidak ditemukan |
400 | Bad Request — isi permintaan tidak valid |