FortiGate REST API
To generate a API token:
execute api-user generate-key <API_user>
eg. execute api-user generate-key api
Static route info:
curl -k -H --"Authorization: Bearer <generated_token>" "https://192.168.0.108/api/v2/cmdb/router/static?access_token=<generated_token>"
eg.
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/router/static?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
Global configuration:
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/system/global?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
Address Group:
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/firewall/addrgrp?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
Policy with serial number 1:
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/firewall/policy/1?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
List API users:
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/system/api-user?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
Access Profile:
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/system/accprofile?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
Interface details:
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/system/interface?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
Interface PORT1 details:
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/system/interface/port1?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
OSPF details:
curl -k -H --"Authorization: Bearer x04gmtfknwk386pctdpn98rkNchjcx" "https://192.168.0.108/api/v2/cmdb/router/ospf?access_token=x04gmtfknwk386pctdpn98rkNchjcx"
Comments
Post a Comment