Skip to main content
farhanahmed
Staff
Staff
March 14, 2025

Technical Tip: How to create a CLI Template and Pre-Run CLI Template using JSON API

  • March 14, 2025
  • 0 replies
  • 580 views
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.