How can i start import/sync jobs via Rest-API?

hello,

i want to start import and sync jobs via director Rest-API.
The basic-documentation is https://icinga.com/docs/director/latest/doc/70-REST-API/

At first, i create a icingaweb2 Webuser with correct permissions and the first steps are fine.
curl -k -u USER:PASSWORD -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -X GET 'https://icingaweb2-localhost.com/icingaweb2/director/host?name=hostname.blabla'

my result:

{
    "address": "hostname.blabla",
    "imports": [
        "default host",
        "default host windows"
    ],
    "object_name": "hostname.blabla",
    "object_type": "object",
    "vars": {
        "admin_importsource": "xxxxxxxx",
        "customer_name_full": "XXXXXXXXXXXXXXXXXX",
        "hidden_monitoringzone": {
            "agent_version": "2.8.2",
            "icinga2_agent_url": "xxxxxxxxx",
            "parent_zone": "xxxxxxx",
            "repository_uri": "xxxxxxxxxxx",
            "slaves": [
                "hostname1",
                "hostname2"
            ]
        },
        "hostgroup": "pnd",
        "os_edition": "Windows Server",
        "os_ipv4address": "xxx.xxx.xxx.xxx",
        "os_operatingmodel": "Managed",
        "os_version": "",
        "ostype": "windows",
        "type": "server"
    },
    "zone": "xxxxxxx"
}

Here is my last curl but canceled with error:
{“status”:“error”,“message”:“No such API endpoint found”}

curl -k -u USER:PASSWORD -H 'Accept: application/json' -H 'X-HTTP-Method-Override: POST' -X POST 'https://icingaweb2-localhost.com/icingaweb2/director/jobs#!/icingaweb2/director/job?id=12'

id=12 is my job, which i want to start via Rest-API.

What is my mistake?

I use rhel7.7 with the following packages:

icinga2-common-2.10.5-1.el7.icinga.x86_64
icinga2-ido-mysql-2.10.5-1.el7.icinga.x86_64
icinga2-bin-2.10.5-1.el7.icinga.x86_64
icinga2-2.10.5-1.el7.icinga.x86_64

icingaweb2-2.6.3-1.el7.icinga.noarch
icingaweb2-vendor-zf1-2.6.3-1.el7.icinga.noarch
icingaweb2-vendor-JShrink-2.6.3-1.el7.icinga.noarch
icingaweb2-common-2.6.3-1.el7.icinga.noarch
icingaweb2-vendor-dompdf-2.6.3-1.el7.icinga.noarch
icinga-rpm-release-7-2.el7.centos.noarch
icingaweb2-vendor-HTMLPurifier-2.6.3-1.el7.icinga.noarch
icingacli-2.6.3-1.el7.icinga.noarch
icingaweb2-vendor-Parsedown-2.6.3-1.el7.icinga.noarch
icingaweb2-vendor-lessphp-2.6.3-1.el7.icinga.noarch
php-Icinga-2.6.3-1.el7.icinga.noarch

AFAIK jobs don’t have an API endpoint, they need to be triggered via icingacli.

Cheers,
Michael

hi michael,

all right, thanks for your fast response.

sascha