Description | This article describes another way on how to get the backup configuration file on FortiGate using HTTPS RestAPI calls from a Python script. |
Scope | FortiGate. |
Solution |
config system api-user
import requests:
api_url = 'https:/10.191.20.122/api/v2/monitor/system/config/backup?scope=global&access_token=Nbcyjfgb....'
requests.packages.urllib3.disable_warnings() data = requests.get(api_url, verify=False) with open('/home/api_configbackup.conf' ,'wb') as f: for line in data: f.write(line)
Where 10.191.20.122 is the IP of the FortiGate.
The scope is global for the global configuration of the FortiGate.
Access_token is the value of the token we previously generated. /home/api_configbackup.conf is the place in the Linux machine where to save the backup file.
The file api_configbackup will be created in the specified directory with the configurations of the Fortigate included. |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.