puppetlabs/puppetdb — pull request #360 by grimradical (2012-11-26 21:13:04+00:00)
Title: Friendlier HTTP endpoints for querying

This changeset is aimed at giving people better ways to slice-and-dice
PuppetDB data without supplying an explicit query. We now expose the
following new endpoints:

* `/nodes/` returns status information for the given node

* `/nodes//facts` returns all the facts for that node

* `/nodes//facts/` returns the specific fact for the indicated
node

* `/nodes//resources` returns all the resources for the given node

* `/nodes//resources/` returns all the resources for the given
node with the supplied type

* `/nodes//resources//

` returns all the resources for
the given node with the supplied type and title.

* `/facts/<fact>` returns all facts with that name, across the population

* `/resources/<type>` returns all resources of that type, across the
population

* `/resources/<type>/<title>` returns all resources of that type and
title, across the population

So you can now do things like hit /resources/User/deepak to get the
details of a specific User object, or things like /facts/kernel to get a
fact across the whole population in one-shot.

Each of these endpoints also allows for an additional "query" parameter,
obeying the same query format we've always suppported. The only
difference is that if you do, say:

/nodes/foo.com/resources?query=...

then the query will only operate on resources for the given node. Basically,
the supplied query is restricted based on information from the URL itself.

This is all currently anchored under /experimental, pending integration
into the existing v2 endpoints.