Schedule Downtime through REST API

Hello together

I tried to set the downtime through this powershell script:

$hostname = ${env:COMPUTERNAME}.ToLower()

Start and End time in epoch

$start_time = [int][double]::Parse((Get-Date (Get-Date).ToUniversalTime() -UFormat %s))
$end_time = [int][double]::Parse((Get-Date (Get-Date).AddDays(1) -UFormat %s))


$user = “xxx”
$pass = “xxxxxxx”
$pair = “${user}:${pass}”
$bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
$base64 = [System.Convert]::ToBase64String($bytes)
$basicAuthValue = “Basic $base64”

Icinga stuff

$Uri = “https://xxxxx:5665/v1/actions/schedule-downtime?host=$hostname&type=Host
$headers = @{ “Authorization” = “$basicAuthValue”; “Accept” = “application/json” }
$body = @{
author = ‘’
comment = ‘Cluster Aware Updating’
child_options = ‘DowntimeNoChildren’
start_time = $start_time
end_time = $end_time
$body = $body | ConvertTo-Json

Ignore self signed certificates

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }

Schedule the downtime

Invoke-RestMethod -Headers $headers -Uri $Uri -Method Post -ContentType ‘application/json’ -Body $body

Don’t ignore self signed certificates anymore

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = $null

When I run the script I get the following error message:

Invoke-RestMethod : The remote server returned an error: (404) Not Found.

Is there something wrong with this script or is there really a problem with my Icinga installation?
I use the following Icinga release r2.10.5-1.

Thank you for my help.

Best Regards