Excerpts from Nick Coghlan's message of 2015-02-19 12:46 +10:00:
I'm trying to use the HTTP APIs documented in
curl --negotiate -H 'Accept: application/json' https://<Beaker
I have a valid Kerberos ticket, but the main page just returns the
HTML list of systems, while the subcollections for available, free and
my systems return a login page redirect.
So it appears either something is broken or the API documentation has
omitted a required setup step.
The endpoints for listing systems (/, /available/, /free/, /mine/) don't
actually offer JSON at all right now. Only Atom or the human-readable
HTML with grid.
The docs are a bit confusing on this point since they mention "pageable
JSON collections" at the very top and then right below it describes the
system listing endpoints. But those are not "pageable JSON collections".
The only two resources that are pageable JSON collections in 19 are
/systems/<fqdn>/activity/ and /systems/<fqdn>/commands/. As we add new
Flask-based APIs they will be consistent.
But the system listing endpoints are much, much older (Beaker 0.6) and
are using the old TG @paginate stuff which is why they are not
consistent with any of the newer APIs. We could probably make the docs
call out this inconsistency more explicitly.
I would like to build new endpoints for listing systems that are
consistent with everything else, and then make the old ones a deprecated
compatibility layer for the new ones. The challenge is the existing very
large pile of code for system searching.
In the meantime, parsing Atom to get a list of systems is quite easy.
The bkr list-systems subcommand does it, in these 5 lines:
response = session.get(feed_url, stream=True)
atom = lxml.etree.parse(response.raw)
titles = atom.xpath('/atom:feed/atom:entry/atom:title',
Dan Callaghan <dcallagh(a)redhat.com>
Software Engineer, Hosted & Shared Services
Red Hat, Inc.