forti-api
forti-api is a header-only C++23 client for the FortiGate REST API (FortiOS v2). Its types are generated from the FortiGate's own schema, so every attribute of a supported object is available, documented and correctly typed, and writes change exactly what you changed.
1#include <forti_api/firewall.hpp>2using namespace fortiapi;3 4auto address = firewall::Addresses::get("LAN 10.0.0.0/24");5address.comment = "managed by forti-api";6firewall::Addresses::update(address); // sends {"comment": "managed by forti-api"} and nothing else
What you get
- Every configuration endpoint: generated from FortiOS 7.4.8 schemas, 487 endpoints on a
FortiGate-60F, one struct per object with every attribute as a
fortiapi::Field<T>, and aTable(list, find, get, contains, add, update, del) orSingleton(get, update) per endpoint. - Typed monitor reads: the read-only monitor endpoints the web GUI uses, with result types
generated from recorded response shapes; everything else through
fortiapi::Monitor. - Exact writes: fields know whether they are absent, read from the device, modified or cleared. An update sends only modified and cleared attributes.
- A careful transport: timeouts, one kept-alive connection per client, URL-encoded object names, typed errors, reads retried on throttling and configuration changes never retried.
- Domain helpers: DNS filter categories, push threat feeds, schedule days, service port ranges, API-user trusted hosts and live interface addresses.
- Header-only: install the
libforti-api-devpackage or vendor the headers; libcurl is the only system dependency.