Gerät aktualisieren PUT
Aktualisiere den Namen oder die Einstellungen eines Geräts.
Endpunkt
PUT https://api.pocketalert.app/v1/devices/{tid}Authentifizierung
Erforderlich
Füge eine dieser Header in deiner Anfrage hinzu:
Token: <your-api-key>— Hol ihn dir unter API-SchlüsselAuthorization: Bearer <jwt-token>— Von Anmelden
Anfrage
Pfadparameter
| Parameter | Typ | Pflicht | Beschreibung |
|---|---|---|---|
tid | string | ✅ | Eindeutige Kennung des Geräts |
Header
| Header | Pflicht | Beschreibung |
|---|---|---|
Token | ✅ | Dein API-Schlüssel |
Authorization | ✅ | Bearer <jwt-token> |
Body-Parameter
| Parameter | Typ | Pflicht | Beschreibung |
|---|---|---|---|
name | string | ✅ | Neuer Gerätename |
Beispielanfrage
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();Antwort
Erfolgreiche Antwort
200 OK
Gerät erfolgreich aktualisiert
json
{
"data": "success"
}Fehlerantworten
| Status | Beschreibung |
|---|---|
401 | Nicht autorisiert — Token ungültig oder fehlt |
404 | Nicht gefunden — Gerät existiert nicht |
400 | Ungültige Anfrage — ungültiger Request-Body |