Installation
Install forti-api from the APT repository, vendor it, or build it from source.
Installation
forti-api is header-only. nlohmann/json 3.12.0 ships with it (installed under
forti_api/third_party, so it never conflicts with a system nlohmann-json); libcurl is the only
system dependency.
A C++23 compiler is required; forti-api is tested with GCC 13 and 14 and with Apple Clang. Link libcurl.
Install forti-api
Pick the method that fits your project: the APT package (Debian and Ubuntu), the Homebrew formula (macOS and Linux), vendored headers, or a build from source.
libforti-api-dev is published to the ValkyrianLabs APT repository:
1sudo install -d -m 0755 /etc/apt/keyrings2sudo curl -fsSL https://apt.valkyrianlabs.com/pubkey.gpg \3 -o /etc/apt/keyrings/valkyrianlabs.gpg4sudo chmod 0644 /etc/apt/keyrings/valkyrianlabs.gpg5 6echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/valkyrianlabs.gpg] https://apt.valkyrianlabs.com stable main" | \7 sudo tee /etc/apt/sources.list.d/valkyrianlabs.list > /dev/null8 9sudo apt update10sudo apt install -y libforti-api-devThe package installs the headers to /usr/include/forti_api and a pkg-config file:
1c++ -std=c++23 app.cpp $(pkg-config --cflags --libs forti-api)With Meson, dependency('forti-api') finds it through pkg-config.
1brew install valkyrianlabs/tap/forti-apiThe formula installs the headers and forti-api.pc into the Homebrew prefix; libcurl comes from the
system. Build with:
1c++ -std=c++23 app.cpp $(pkg-config --cflags --libs forti-api)Recent Homebrew versions ask you to trust a third-party tap first: brew trust valkyrianlabs/tap.
Copy include/ and third_party/nlohmann/include/ from the repository into your project, add
both to the include path and link libcurl (-lcurl).
Meson projects can also use forti-api as a subproject: dependency('forti-api') resolves to it.
As a subproject, forti-api builds no example or tests and installs nothing, so meson install of
your project does not install forti-api's headers or forti-api.pc.
1# Ubuntu: sudo apt install meson ninja-build g++ pkgconf libcurl4-openssl-dev2# macOS: brew install meson ninja (libcurl comes with the SDK)3meson setup build4meson install -C buildThe headers install to <prefix>/include/forti_api and forti-api.pc to
<prefix>/share/pkgconfig.
Install locations
| Method | Headers | pkg-config file |
|---|---|---|
| APT | /usr/include/forti_api | installed; pkg-config forti-api |
| Homebrew | the Homebrew prefix | forti-api.pc in the Homebrew prefix |
| Vendoring | wherever you copy include/ and third_party/nlohmann/include/ | none |
| Meson subproject | not installed | not installed |
| From source | <prefix>/include/forti_api | <prefix>/share/pkgconfig/forti-api.pc |
Next steps
Quick start
Connect to a FortiGate and read, change and create objects.
Configuration
Environment variables and fortiapi::Config fields.