Fortinet black logo

Uploading license files with Restful API

Copy Link
Copy Doc ID ec92e3b6-edeb-11ea-96b9-00505692583a:153623
Download PDF

Uploading license files with Restful API

File upload is achieved in the following steps:

Authentication

curl -k -H "Content-Type: application/json" -X POST -d '{"name":"admin","password":"11"}'

https://host_or_ip/api/v1/VoiceadminLogin -c cookie.txt

Output:

{"objectID": "VoiceadminLogin:{D:system}","reqAction": 2,"nodePermission": 3,"name":

"admin","password": "11","new_password": "******","token": "******","vpbx": true,"role":

2,"license": 0,"is_superadmin": true,"webmode": 0,"locale": "en","loginstatus": 1,"model":

"FO4000","serial": "FO4000YYZRD00006","theme": 3,"debug": true,"product_name":

"FortiVoice","product_version": "6.4.307","disclaimer_enable": false,"scramble": true,"disclaimer":

"","gateway_status": false,"departments": "","userportal_status": true,"operator_console_status":

true,"lsg_status": true,"localsurvival_mode": 0,"business_group_status": true,"minimum_length":

8,"survivability_centralstatus": true,"magic_number": "rb"}

Getting the upload authorization token

curl -k -b cookie.txt -H "Content-Type: application/json" -X POST -d '{"reqAction":22}'

https://host_or_ip/api/v1/SysStatusLicinfo

Output:

{"token":"d45885ac1c2532686bf3554b65a781a7M500"}

Uploading a file with the authorization token returned in previous step

curl -k -b cookie.txt -X POST -F 'license=@/home/elvis/Licences/call_center_trial_one_year.lic' -F

'token=d45885ac1c2532686bf3554b65a781a7M500' 'https://host_or_ip/api/v1/uploadfile/'

Output:

{"id":"license_WssKBI"}

Applying the uploaded file with file ID returned in previous step

curl -k -v -b cookie.txt -H "Content-Type: application/json" -X PUT -d

'{"vm_lic_file":"license_WssKBI", "reqAction":"5"}' 'https://host_or_ip/api/v1/SysStatusLicinfo'

Output:

{"objectID": "SysStatusLicinfo:{D:system}","reqAction": 5,"nodePermission": 3,"vm_lic_file": ""}

Uploading license files with Restful API

File upload is achieved in the following steps:

Authentication

curl -k -H "Content-Type: application/json" -X POST -d '{"name":"admin","password":"11"}'

https://host_or_ip/api/v1/VoiceadminLogin -c cookie.txt

Output:

{"objectID": "VoiceadminLogin:{D:system}","reqAction": 2,"nodePermission": 3,"name":

"admin","password": "11","new_password": "******","token": "******","vpbx": true,"role":

2,"license": 0,"is_superadmin": true,"webmode": 0,"locale": "en","loginstatus": 1,"model":

"FO4000","serial": "FO4000YYZRD00006","theme": 3,"debug": true,"product_name":

"FortiVoice","product_version": "6.4.307","disclaimer_enable": false,"scramble": true,"disclaimer":

"","gateway_status": false,"departments": "","userportal_status": true,"operator_console_status":

true,"lsg_status": true,"localsurvival_mode": 0,"business_group_status": true,"minimum_length":

8,"survivability_centralstatus": true,"magic_number": "rb"}

Getting the upload authorization token

curl -k -b cookie.txt -H "Content-Type: application/json" -X POST -d '{"reqAction":22}'

https://host_or_ip/api/v1/SysStatusLicinfo

Output:

{"token":"d45885ac1c2532686bf3554b65a781a7M500"}

Uploading a file with the authorization token returned in previous step

curl -k -b cookie.txt -X POST -F 'license=@/home/elvis/Licences/call_center_trial_one_year.lic' -F

'token=d45885ac1c2532686bf3554b65a781a7M500' 'https://host_or_ip/api/v1/uploadfile/'

Output:

{"id":"license_WssKBI"}

Applying the uploaded file with file ID returned in previous step

curl -k -v -b cookie.txt -H "Content-Type: application/json" -X PUT -d

'{"vm_lic_file":"license_WssKBI", "reqAction":"5"}' 'https://host_or_ip/api/v1/SysStatusLicinfo'

Output:

{"objectID": "SysStatusLicinfo:{D:system}","reqAction": 5,"nodePermission": 3,"vm_lic_file": ""}