Queries
VDOMs, filters, field selection and paging with fortiapi::Query.
Queries
Every endpoint call takes an optional fortiapi::Query. Values are URL-encoded for you.
1using fortiapi::Query;2 3auto enabled = firewall::Policies::list(Query().filter("status==enable"));4auto names = firewall::Addresses::list(Query().format({"name", "subnet"}));5auto page = firewall::Addresses::list(Query().start(100).count(50));6auto dmz = firewall::Policies::list(Query().vdom("dmz"));
| Method | Parameter | Use |
|---|---|---|
vdom(name) | vdom | Target a VDOM (overrides Config::vdom) |
filter(expression) | filter | FortiOS filter expression; repeated calls are combined with AND |
format({fields...}) | format | Return only these attributes (`name |
start(n), count(n) | start, count | Paging |
datasource() | datasource | Include datasource details |
with_meta() | with_meta | Include object metadata |
skip() | skip | Skip attributes not applicable to the object |
action(name) | action | Endpoint actions such as schema or default |
set(key, value) | any | Any other parameter |
Filter expressions use FortiOS syntax, for example name==web, name=@web (contains) or
status!=disable; separate alternatives with a comma inside one expression for OR.
Object keys are always URL-encoded, so names with spaces or slashes work as-is:
1auto subnet = firewall::Addresses::get("LAN 10.0.0.0/24");