I am trying to write postgre puppet AST query in java script/coffee script, but I am not able to figure out how to send data (curl -d) through a GET request in java/coffree scripts. Can anyone help?
curl -X GET http://puppetdb.com:8080/pdb/query/v4/reports -d 'query=["extract", ["hash", "end_time", "certname", "status", "noop", "metrics", "configuration_version", "environment"], ["and", ["=", "status", "failed"], ["and", ["=", "latest_report?",true]]]]'
I got the solution for this problem, can do this using query string querystring = require('querystring') query='["extract", ["hash", "end_time", "certname", "status", "noop", "metrics", "configuration_version", "environment"], ["and", ["=", "status", "failed"], ["and", ["=", "latest_report?",true]]]]' options = host: opts.host port: opts.port path: '/pdb/query/v4/nodes?' + querystring.stringify(query: query)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.