Transmit additional attributes when registering via Self Service API

The self service api can’t change that ( REST API - Icinga Director. But you could use the default director api:

$paswd = ConvertTo-SecureString "mypass" -AsPlainText -Force
$cred = New-Object Management.Automation.PSCredential ('myuser', $paswd)
Invoke-RestMethod -Uri "https://monitoring.host.tld/director/host?name=$(Get-IcingaHostname -AutoUseFQDN $true -LowerCase $true)" -Method Post -Headers @{"Accept"="application/json"} -Credential $cred -Body (@{"vars.nspassword"="thensclientpassword"} | ConvertTo-Json)

For permissions see: Register Agent with Director Self-Service API for existing Host AND change assigned Template - Icinga Director - Icinga Community

1 Like