[SOLVED] How to get list of all items from curl parameters
by witchkinkofangmar from LinuxQuestions.org on (#5H379)
I have a script using the host_find method request and I just want it to return a list of all fqdns, nothing else. Currently, it returns every parameter for every host.
Current:
Code:{"result": {"result": [{"fqdn": ["hostname.org.com"], "krbprincipalname": ["host/hostname.org.com@ORG.COM"], "krbcanonicalname": ["host/hostname.org.com@ORG.COM"], "sshpubkeyfp": ["SHA256:IMP+uhytndtayi2WZOItv9897Pl/y68kiB6P2H5W+A (ecdsa-sha2-nistp256)", ........
.......
.......
.......Needed:
Code:{"result": {"result": [{"fqdn": ["hostname.org.com"] or just Code:hostname.org.comMethod Request:
Code:# Send host_find method request
curl -k -v \
-H referer:https://$IPAHOSTNAME/ipa \
-H "Content-Type:application/json" \
-H "Accept:applicaton/json"\
-c $COOKIEJAR -b $COOKIEJAR \
--cacert /etc/ipa/ca.crt \
-d '{"method":"host_find","params":[[""],{}],"id":0}' \
-X POST \
https://$IPAHOSTNAME/ipa/session/json


Current:
Code:{"result": {"result": [{"fqdn": ["hostname.org.com"], "krbprincipalname": ["host/hostname.org.com@ORG.COM"], "krbcanonicalname": ["host/hostname.org.com@ORG.COM"], "sshpubkeyfp": ["SHA256:IMP+uhytndtayi2WZOItv9897Pl/y68kiB6P2H5W+A (ecdsa-sha2-nistp256)", ........
.......
.......
.......Needed:
Code:{"result": {"result": [{"fqdn": ["hostname.org.com"] or just Code:hostname.org.comMethod Request:
Code:# Send host_find method request
curl -k -v \
-H referer:https://$IPAHOSTNAME/ipa \
-H "Content-Type:application/json" \
-H "Accept:applicaton/json"\
-c $COOKIEJAR -b $COOKIEJAR \
--cacert /etc/ipa/ca.crt \
-d '{"method":"host_find","params":[[""],{}],"id":0}' \
-X POST \
https://$IPAHOSTNAME/ipa/session/json