Hello,
I’m trying to use the iControl REST API to communicate with the F5s. There’s a “$filter” parameter that can be passed along with GET requests, but the only examples I’ve seen use that to filter the partition - I would like to filter on more than that (a different field, such as “destination”, for example).
Is this possible? The F5 always complains when I try.
Thanks for any help in advance!
Looks like the $filter parameter only supports partition. The “About query parameter” section of iControl REST API User Guide states:
$filter: Specifies an administrative partition to query for a result set. This parameter filters the result set by partition name and does not fully implement the corresponding $filter OData query parameter. The asm module fully implements the OData query parameter.
Okay, thank you! That’s quite disappointing that there’s no native way to filter the API results. It can take quite a long time to return all the objects for a given endpoint!
One option is to run a script on the BIG-IP box via iControl REST, and retrieve the result after it completes. If the tasks are mostly tmsh related, a tmsh script might be good. You can execute a tmsh script like this:
curl -sku $PASS https://$HOST/mgmt/tm/cli/script/sat.tcl \
-X POST -H "Content-type: application/JSON" \
-d '{"command":"run"}'
where sat.tcl is the script.
A sample tmsh script that writes configuration information of all the ltm virtuals to /tmp/sat.txt.
proc script::run {} {
set fd [open "/tmp/sat.txt" "w+"]
set virtuals [tmsh::get_config ltm virtual]
puts $fd $virtuals
close $fd
}
See also TMSH Configuration & Status Commands.