Delete host object over the Rest api not created by a api

Hi,

I want to delete a host via the Rest Api.
But I get a 500 error with this message:

HTTP/1.1 500 Internal Server Error
Server: Icinga/r2.13.5-1
Content-Type: application/json
Content-Length: 330

{
    "results": [
        {
            "code": 500,
            "errors": [
                "Object cannot be deleted because it was not created using the API."
            ],
            "name": "test123,
            "status": "Object could not be deleted.",
            "type": "Host"
        }
    ]
}

The request is like in the dokumentation:

curl -k -s -S -i -u "user":"password" -H 'Accept: application/json' -X DELETE 'https://Icingahost.local:5665/v1/objects/hosts/test123?cascade=1&pretty=1'

Is it possible to force deletion via API or why is it not possible to delete a host over the rest api?

Thank you

how was the object created?

Sorry for the late answer.
The object are created by the director gui or the icingacli.

then you need to use director api or icingacli to delete it, don’t forget to deploy

Thanks you. It works on this way.