Get agent hash for a list of hosts

Hey @ll,

i would like to download and store checkmk agents programatically from the checkmk bakery for further processing for a list of hosts.
To save space and computation time, i only want to download created agent packages that belong to multiple hosts once, and then install these on the hosts that have the corresponding hashes assigned.
Currently I only have two ways to download an agent, one by hostname and one by hash.

/check_mk/api/1.0/domain-types/agent/actions/download_by_host/invoke?os_type=linux_tgz&host_name=example.com

and

/check_mk/api/1.0/domain-types/agent/actions/download_by_hash/invoke?os_type=linux_tgz&agent_hash=80e99ba3a66d4880

As far as I can see, there is no reverse way to ask “which hosts use agent xyz”.
Currently i created a multiside view that lists hosts with their assigned hash in a table, but that is more a workaround that I would like to prevent.
I also would like to prevent to loop through all hosts to see what the API would present as a package download.
Any ideas ? :slight_smile: