Powershell to get list of hosts

New issue, in checkmkdowntime at:
$URI += “$checkmkserver/$checkmkinstance/check_mk/webapi.py”
#build the web request for checking if the host exists in check_mk
$Body = @{
action=“get_host”
_username=$checkmkuser
_secret=$checkmksecret
request_format=“json”
output_format=“json”
hostname=$hostname
}

$result = Invoke-WebRequest -Uri $URI -Method Post -Body $Body -UseBasicParsing
.
.
.
if ( ($result.content | ConvertFrom-Json).result_code -ne 0 )

$result.content = {“result”: “Hostname is missing”, “result_code”: 1}

Yet, in $Body hostname is set correct. The same hostname that work with function checkmkhealth

Any ideas?