I’ve had a lot of recent requests from my customers for some better examples of Puppet API calls with AST and PQL queries.
To that end, I’ve created a quick github repository with some better example scripts for Powershell and Curl. You can find the git repo here: https://github.com/psreed/puppet_enterprise_api_playground
In addition, since most of the Puppet APIs spit out JSON format, I’d recommend using “Miller” to manipulate the outputs if you need to manipulate the data further before handing over to other APIs, Databases or report files (i.e. CSV/TSV, etc..). You can find Miller here: https://github.com/johnkerl/miller