-
-
Notifications
You must be signed in to change notification settings - Fork 128
Open
Labels
staleThere has not been activity on this issue or PR for quite some time.There has not been activity on this issue or PR for quite some time.
Description
Hey Guys,
i found a bug in this integration. I control my hosts via API and the problem is that when i disable the host via API the host shows as disbaled in the NPM GUI but is still reachable, to really disable the host i need to disable via mouse in the GUI.
Can this fix someone? On bottom i post a test api script for enable disable via api so the devoloper can test this
Powershell Test Script:
##Host deaktivieren
$Token = Invoke-RestMethod -Uri http://192.168.178.100:81/api/tokens -Method POST -ContentType "application/json" -Body '{"identity":"E-Mail","secret":"Passwort"}'
$Token.Token
##Host-ID abfragen
$token = $Token.Token
$baseUrl = "http://192.168.178.100:81/api/nginx/proxy-hosts"
$headers = @{ Authorization = "Bearer $token" }
#Host-ID abfragen
$hostId = 2
$baseUrl = "http://192.168.178.100:81/api/nginx/proxy-hosts"
$headers = @{ Authorization = "Bearer $token" }
# Hosts abrufen
$response = Invoke-RestMethod -Uri $baseUrl -Headers $headers -Method Get
# Host-ID deaktivieren
$hostId = 2
$baseUrl = "http://192.168.178.100:81/api/nginx/proxy-hosts"
$headers = @{ Authorization = "Bearer $token" }
# Alle Hosts abrufen
$response = Invoke-RestMethod -Uri $baseUrl -Headers $headers -Method Get
# Gewünschten Host auswählen
$host2 = $response | Where-Object { $_.id -eq $hostId }
# Neues Objekt mit nur erlaubten Feldern zusammenbauen
$updateHost = [PSCustomObject]@{
enabled = 0 # deaktivieren
#enabled = 1 # aktivieren
}
# PUT-URL für den Host
$putUrl = "$baseUrl/$hostId"
# JSON erzeugen
$jsonBody = $updateHost | ConvertTo-Json -Depth 10
# PUT Request senden
Invoke-RestMethod -Uri $putUrl -Headers $headers -Method Put -ContentType "application/json" -Body $jsonBody
Write-Output "Host ID $hostId wurde deaktiviert (enabled=0)."
Metadata
Metadata
Assignees
Labels
staleThere has not been activity on this issue or PR for quite some time.There has not been activity on this issue or PR for quite some time.