Ask Your Question
0

pass parameters to puppet api's not from curl

asked 2016-04-05 01:08:55 -0500

hKothuri gravatar image

updated 2016-04-05 08:45:37 -0500

Hi, I'm new to puppet and couldn't find from docs that how to pass parameters to api from any http client and not from curl.

Example:- I can get all the nodes information with URL http://puppet-master:8080/pdb/query/v4/nodes/ from browser itself.

Now i want to get the specific node information by certname like http://puppet-master:8080/pdb/query/v4/nodes/certname='name'

Thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-04-05 10:21:32 -0500

hKothuri gravatar image

updated 2016-04-05 10:27:23 -0500

http://puppet-master:8080/pdb/query/v4/nodes/magpie.example.com is giving the response.

edit flag offensive delete link more

Comments

Great that also works if you just need one node. :)

Alex Harvey gravatar imageAlex Harvey ( 2016-04-05 10:36:30 -0500 )edit
0

answered 2016-04-05 08:52:26 -0500

updated 2016-04-06 00:34:39 -0500

It should be something like:

curl -G 'http://puppet-master:8081/pdb/query/v4/nodes' --data-urlencode 'query=["=", "certname", "magpie.example.com"]'

From the documentation.

It's not possible to pass complex queries in the URL; the HTTP POST method must be used, and the query string is sent in the data; whereas that query string that appears at the end of the URL is a feature of HTTP GET requests. See here for more info.

Doing this programmatically is not hard, and well documented. Just look up "http post" for whichever language you're using.

edit flag offensive delete link more

Comments

Hi Alex, I am aware of parameter(s) usage from curl. But my question is how to pass parameters in the uri itself Ex: http://puppet-master:8080/pdb/query/v4/nodes/certname="magpie.example.com" This way, i can integrate with other applications and get the required information. Thanks

hKothuri gravatar imagehKothuri ( 2016-04-05 10:08:50 -0500 )edit

Sorry, I missed the bit "not from curl". I'll update my answer.

Alex Harvey gravatar imageAlex Harvey ( 2016-04-05 10:26:35 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-04-05 01:08:55 -0500

Seen: 73 times

Last updated: Apr 06 '16