FortiManager
FortiManager supports network operations use cases for centralized management, best practices compliance, and workflow automation to provide better protection against breaches.
tnesh
Staff & Editor
Staff & Editor
Article Id 390256
Description

 

This article describes how to move a policy package and folder to a different folder using the JSON API.

 

Scope

 

FortiManager.

 

Solution

 

Here is the initial policy package and folder location before any changes:

 

before-move-pp.png

 

Scenario 1: Move policy package.

  • Following the JSON API will move 'policy-package-002' from 'folder-001' to 'folder-002'. Make sure dst_name, dst_parent & pkg is mentioned correctly:

 

{
  "method": "exec",
  "params": [ {
          "data": {
          "adom": "ADOM-001",
          "dst_name": "policy-package-002",
          "dst_parent": "folder-002",
          "pkg": "folder001/policy-package002"
          },
          "url": "/securityconsole/package/move"
          }],
  "session": "{{session}}",
  "verbose": 1,
  "id": 1
}

 

To clone the package, change the URL to: '/securityconsole/package/clone'.

 

  • Here is the policy package location after the API runs successfully:

 

after-move-pp.png

 

Scenario 2: Move folder.

  • Following the JSON API will move 'folder-002' under 'folder-001'. Make sure dst_name, dst_parent & pkg is mentioned correctly:

 

{
  "method": "exec",
  "params": [ {
          "data": {
          "adom": "ADOM-001",
          "dst_name": "folder-002",
          "dst_parent": "folder-001",
          "pkg": "folder-002"
          },
          "url": "/securityconsole/package/move"
          }],
  "session": "{{session}}",
  "verbose": 1,
  "id": 1
}

 

  • Here is the folder location after the API runs successfully:

 

after-move-folder.png

 

Scenario 3: Move folder/policy package to root folder:

  • Following the JSON API will move 'folder-002' back to the 'root folder'. Make sure dst_name, dst_parent & pkg is mentioned correctly:

 

{
  "method": "exec",
  "params": [ {
          "data": {
          "adom": "ADOM-001",
          "dst_name": "folder-002",
          "dst_parent": "",
          "pkg": "folder-001/folder-002"
          },
          "url": "/securityconsole/package/move"
          }],
  "session": "{{session}}",
  "verbose": 1,
  "id": 1
}

 

  • Here is the folder location after the API runs successfully:

 

after-move-to-root-folder.png

 

Note:

In case Workspace mode is enabled on FortiManager, it is required to lock the ADOM.

Refer to the article: Technical Tip: How to lock/unlock an ADOM and commit changes in FortiManager using the JSON API.

 

Troubleshooting:

The following commands can be used on the FortiManager CLI to debug the API Calls:

 

diagnose debug service httpd 255

diagnose debug service main 255

 

Related documents:

Technical Tip: Using FortiManager API

Fortinet Development Network (FNDN) - FortiManager