Forum Discussion
iControlRest - How to limit the output to a single parameter?
Hi,
I'm aware that you can pass ?$select= to limit the iControlRest output to a single parameter. It does reduce the output significantly, but its still a bit too much.
Question - how can I further reduce the output (using iControl) to have only the following output:
"fullPath":"/Common/mysecurity-policy_443"
Instead of
[root@bigip1:Active:Changes Pending] ~ curl -sk -u admin:admin https://localhost/mgmt/tm/asm/policies/V9NGrsJI4rJFeyE6uYG7yw/?\$select=fullPath
{"selfLink":"https://localhost/mgmt/tm/asm/policies/V9NGrsJI4rJFeyE6uYG7yw$select=fullPath","kind":"tm:asm:policies:policystate","fullPath":"/Common/mysecurity-policy_443"}
[root@bigip1:Active:Changes Pending] ~
1 Reply
Check out the jq command line JSON processor. You can run your curl command and use jq to parse and select elements. More details here: http://stedolan.github.com/jq
$ curl -sk -u admin:admin https://localhost/mgmt/tm/asm/policies/V9NGrsJI4rJFeyE6uYG7yw/?\$select=fullPath | jq "{fullPath: .fullPath}"`Will return
{ "fullPath": "/Common/mysecurity-policy_443" }It doesn't change the amount of data downloaded but should help with client-side parsing.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
