FortiManager
FortiManager supports network operations use cases for centralized management, best practices compliance, and workflow automation to provide better protection against breaches.
farhanahmed
Staff
Staff
Article Id 382084
Description This article describes how to create a CLI Template and Pre-Run CLI Template using JSON API.
Scope FortiManager, JSON-API.
Solution

A CLI Template can be created using API request below:

{
 "method": "add",
 "params": [
        {
            "data": [

                {
                   "description": "{{DESCRIPTION}}",
                   "name": "{{TEMPLATE_NAME}}",
                   "provision": "disable",
                   "script": "config system global\nset hostname FGT40F\nend",
                   "type": "cli"
                },

           ]
            "url": "pm/config/adom/{{ADOM}}/obj/wireless-controller/vap/"
        }
    ],
    "session": "{{session}}",
    "id": "1"

}

 

Sample output:

 

1.png

 

To create a Pre-Run CLI template, use the same API request and set 'provision': 'enable' on line #9. To create a JINJA template, set 'type': 'jinja' on line #11.
 

Related articles:
Technical Tip: Using FortiManager API.
Fortinet Development Network (FNDN) - FortiManager.
Technical Tip: How to create IPSec Template and assign to a device using JSON API.