The required parameters of the API for UF Add-ins can be read out as follows:
- Log in to the web interface of the Unified Firewall.
- Open the Developer Tools in your browser (usually F12) and switch to the menu Network.
- Perform the desired configuration locally and record it in Developer Tools.
- Copy the payload from request with status 201.
API for Unified Firewall Add-ins
Including the API as a variable simplifies calls to the following methods.
var ufApi = config.getUfApi();
The configuration of a Unified Firewall consist of entities and singletons.
Entities: Entities are configuration parameters where multiple entries can be made (e.g. network-connections).
Singletons: A singleton is a configuration parameter that exists only once in the Unified firewall (e.g. device name).
API methods for Unified Firewall Add-ins
ufAPI.raw: Raw API Requests are the general way how the API for UF Add-ins can be addressed. Various methods can be used to create, edit and delete configurations. Furthermore, it is possible to query configuration values.
- Example:
ufAPI.raw({ method: PUT|POST|GET|DELETE , uri: URI, body: { key: value, key: value, key: value }, failOnError: true|false })
Auxiliary methods:
The following methods simplify RAW requests:
ufAPI.lookup/ufAPI.lookupField: Various requests require the query of a UUID or a name field in the firewall configuration.
- The ufAPI.lookup method can be used to retrieve the UUID for required parameters (e.g. Ethernet interfaces).
- Example:
ufAPI.lookup("Entity", { key: value });
- Example:
- Parameters that do not have a UUID (e.g. routing table) are queried with the ufAPI.lookup.Field method.
Example:
ufAPI.lookupField("Singleton", { key: value });
ufAPI.createObject: The ufAPI.createObject method is used to configure entities (e.g. network connections).
- Example:
ufAPI.createObject("Entity", { key: value, key: value, key: value });
- Example:
ufAPI.modifyObject/ufAPI.modifySettings:
- The ufAPI.modifyObject method can be used to edit configurations of entities (e.g. network connections).
- Example:
ufAPI.modifyObject("Entity", ufAPI.lookup, { key: value, key: value, key: value })
- Example:
- To customize singletons (e.g. firewall device name), the ufAPI.ModifySettings method is used.
- Example:
ufAPI.modifySettings("Singleton", { key: value });
- Example: