Add hosts, zones and endpoints automated through the director api

Hi,
i want to add hosts, zones and endpoints automated through the director api.
Adding new hosts works. For that I use the following code in Ansible:
grafik
grafik
As I already read, not all API endpoints are documented. (https://github.com/Icinga/icingaweb2-module-director/issues/1082) That’s why I tried with a GET request to find out how the body has to be constructed. After this output:
grafik
did I build my GET request like this:
grafik
grafik
Now I get the same output as with the GET request, but the zone is not created.
My question, is it possible to create zones and endpoints using the director API? And if so, what is the API endpoint like?

Why exactly do you want to create the hosts and zones manually? Actually the icinga2 director will create the zone and endpoint for the host. I am not entirely sure if it’s the same behaviour when you create hosts via the UI as when you do it via the API but I think it is.

Did you try to create just the host via the API and check if it just works?

Btw. I assume you use Icinga2 2.11?

Thank you, Marcel for your reply.
When I create a host, I must create the zone and the endpoint also manually.
But I use the following versions:
icinga2: 2.10.4
icinga2 Web 2 Version: 2.6.3
director: 1.6.2

I don’t know that the newer versions make it easier to add a host. This sounds good!