Skip to content

Instantly share code, notes, and snippets.

@garthk
Created October 9, 2012 23:22
Show Gist options
  • Save garthk/3862106 to your computer and use it in GitHub Desktop.
Save garthk/3862106 to your computer and use it in GitHub Desktop.
Trying to get information out of puppetdb directly (puppetdb 0.9)
$ curl -vH "Accept: application/json" 'http://localhost:8080/resources' --data-urlencode 'query=["not", ["=", "type", "Nonsense"]]'
* About to connect() to localhost port 8080 (#0)
* Trying ::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /resources HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: localhost:8080
> Accept: application/json
> Content-Length: 78
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 405 Method Not Allowed
< Date: Tue, 09 Oct 2012 23:20:26 GMT
< Allow: GET
< Content-Length: 0
< Server: Jetty(7.x.y-SNAPSHOT)
<
* Connection #0 to host localhost left intact
* Closing connection #0
#!/bin/sh
# from: http://docs.puppetlabs.com/puppetdb/1/spec_q_resources.html
# ... except with one key mistake
curl -H "Accept: application/json" 'http://localhost:8080/resources' --data-urlencode 'query=["not", ["=", "type", "Nonsense"]]'
#!/bin/sh
# from: http://docs.puppetlabs.com/puppetdb/1/spec_q_nodes.html
curl -H "Accept: application/json" 'http://localhost:8080/nodes'
#!/bin/sh
# from: http://docs.puppetlabs.com/puppetdb/1/spec_q_resources.html
# ... except with one key mistake
curl -G -H "Accept: application/json" 'http://localhost:8080/resources' --data-urlencode 'query=["not", ["=", "type", "Nonsense"]]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment