Essentially, we're going to use the same techniques that we learned in the previous examples, but the way we process the data is going to change. One thing you'll almost immediately notice is that each endpoint has its own particular format; although they all return JSON output, sometimes, it's a JSON array, other times, a flat JSON document, and so on. When working with PuppetDB, it's worth reviewing the documentation for the endpoints, as it contains an excellent rundown of what to expect. Again, you can find the documentation at https://docs.puppetlabs.com/puppetdb/latest/.
Tip
One tool that can be enormously helpful when exploring data such as the PuppetDB API is the pp
library that ships with Ruby. The pp
library is the pretty printer for Ruby and will take data such as JSON and output it in a reasonably clear way. This can be a real help if you are not sure how or what data is going to be returned. If you get stuck, remember that you can use the...