Icingacli add service to host

Hi there!
I’m trying to figure out, how the CLI works for adding monitored services to a host.
I could not find the right command.
We are very dynamic in creating new servers and also deleting them, so we want icinga more dynamic.
Based on a (sharepoint) list, hosts are created in icinga through

icingacli director host create <hostname> --imports 'Icinga Agent Linux' --address <IP>

But how can I add further services to this host?

I don’t know the director commands, but you can use the API directly, too:

do not use icinga api directly, these objects are not managable by director.

icingacli director <type> create [<name>] [options]


  --<key> <value>   Provide all properties as single command line
  --json            Otherwise provide all options as a JSON string


  icingacli director host create localhost \
    --imports generic-host \
    --address \
    --vars.location 'My datacenter'

  icingacli director host create localhost \
    --json '{ "address": "" }'
icingacli director service create specialservice --host hostname
Service 'specialservice' has been created

Sorry to correct you but that is not true.
You may use a customized version of this helper script to create hosts and services in the director.
It took a lot of time to trial and error this, but you may use this command for further inspiration.

director-curl PUT "director/host" "{ \"object_name\": \"${HOST}\", \"object_type\": \"object\", \"imports\": [ \"${host_template}\" ], \"address\": \"${IP}\", \"notes\": \"${host_notes}\", \"vars.custom_array_var1\": [ \"asdf\", \"foo\" ]  }

I mostly use a local icingaweb2-user with full permissions for director, no other permissions. You may reduce those permissions, too

Thank you for your reply, here is a follow up for you.
icinga api → port 5665 → the way icinga nodes talk to each other
director api → available via icingaweb → the same result as using icingacli director

if you use this helper script your are using icingaweb2/director api not icinga api