Technical Tip: Install policy package from policy folder using JSON API
Description
This article describes how to install policy package from a policy folder using JSON API.
Scope
FortiManager.
Solution
In FortiManager, policy package folders are used to organize policy packages. When installing a policy package through API, the folder is not provided as a separate field. Instead, the policy package name must include the folder path.
Example API syntax to install policy package from folder:
{
"session": "{{session}}",
"id": 1,
"method": "exec",
"params": [
{
"url": "/securityconsole/install/package",
"data": [
{
"adom": "{{adom}}",
"pkg": "<policy folder name>/<package name>",
"scope": [
{
"name": "FortiGate",
"vdom": "root"
}
],
"flags": "none"
}
]
}
]
}
For policy package inside nested folders, the package name should include all folders in the hierarchy as shown below:
“pkg”: “Parent folder/child-folder/package name”
Related document:
