FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
bkarl
Staff
Staff
Article Id 247199
Description

This article describes how to deploy a REST API Admin user and change the super_admin_readonly profile by default  to perform a full backup.

Scope FortiGate v7.2.4.
Solution
  1. Go to System ->Administrators -> Create New -> REST API Admin.

 

bkarl_0-1677360013603.png

 

  1. Create the user, in this example 'test_api'. Do not forget to copy the API Key when backing up the config file.

 

bkarl_1-1677360030875.png

 

In case a new API key needs to be generated, it can be regenerated:

 

bkarl_2-1677360043640.png

 

 

  1. Change the profile by CLI:

 

config system api-user

    edit test_api

        set accprofile "super_admin_readonly" <----- Change the profile previously assigned by GUI.

(test_api) # set accprofile super_admin <----- This change can only be performed by CLI.

end

 

To create an API user via CLI :

 

config system api-user

    edit test_api

        set api-key ************

        set accprofile super_admin

        set vdom "root"
    end

 

Generate the API token: 

 

execute api-user generate-key <API username>

 

From v7.6.x, it is also possible to add the expiry date of the API key. 

 

execute api-user generate-key <API username> <expiry time>

 

For example: 

 

execute api-user generate-key test_api 480   <----- Optional expiry of API key in minutes.

 

Note:

Do not forget that if the configuration file is backed up with a super_admin_readonly, all configurations will not be visible.

 

Related documents:

execute api-user

REST API administrator