Katello - limit package information when querying packages for host

Problem:
When asking for applicable packages for some host, a sequence of package data is returned from the API.

/katello/api/v2/packages?host_id=123&packages_restrict_latest=true

For every package, data about
id, pulp_id, name, version, release, arch, epoch, summary, modular, filename, sourcerpm, checksum, nvrea, nvra, uuid, hosts_available_count, hosts_applicable_count
will be returned.

Is there a way to limit the amount of information?

Since I need to query data for a lot of hosts, retrieving full package information would be highly redundant. I would rather like to receive only the id of the package.
Package information could the later be asked for via

/katello/api/v2/packages/123

Unfortunately the API does not offer a way to customize what data is returned. You would have to do a direct SQL query to the katello_installed_packages and katello_host_installed_packages tables in Postgres.

Or if it’s Katello 4.7 or later, perhaps you could clone and customize the Host - All Installed Packages report template.

Ah, too bad this isn’t possible via API. But thank you very much for pointing out possible alternatives.
I won’t have access to the database, but I will discuss my own template with our Foreman/Katello maintainers.

1 Like