API: Efficient way to get host collections and its hosts

Solution In Progress - Updated -

Issue

  • The api seems to be really inefficient to query. The only way I found was to do the following.
    Request /katello/api/v2/organizations/1/host_collections

  • This gives me a list of host_collections.
    For each host collection!! I need to get a list of host ids!

/katello/api/v2/host_collections/$o->{id}
  • With 53 host collections you already have 53 requests to just get the host_ids but not the host names.
    Now this gets really silly. For each host_id I need to either do another request to get the hostname or grab all the hosts first and match the host_ids..

  • So ideally the first request should already return the host_ids and hostnames. At least it should return the host_ids.

  • Maybe I was missing something. The documentation shows an argument called "full_results" but that does not seem to do anything.

Environment

  • Satellite 6.2
  • api

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.