Hello everyone :)
As the name suggests, I'm trying to recover the ip addresses of my fortigate's interfaces.
I found this command but it only returns the interface name: /api/v2/cmdb/system/interface/Overlay-A/
"results": [
{
"name": "Overlay-A",
"q_origin_key": "Overlay-A",
"q_limited_permission": true
}
],
I've seen in the GUI via the API Preview button that there are formats with ip, remote-ip, etc. fields, but the following command doesn't return anything satisfactory: /api/v2/cmdb/system/interface/Overlay-A?format=ip
"results":[
{
"q_limited_permission":true
}
],
Can you please help me with this?
Hyjaal
Solved! Go to Solution.
Hello @Hyjaal ,
I tried with these curl commands, I can get my interface list with no problem.
curl -k -i -X POST https://x.x.x.x/logincheck -d "username=<USER_NAME>&secretkey=<USER_PASSWORD>" --dump-header headers.txt -c cookies.txt
curl -k -i -X GET https://x.x.x.x/api/v2/cmdb/system/interface -b headers.txt
Hello @Hyjaal ,
If you send a request to your FortiGate like that you can access all interface configurations.
https://x.x.x.x/api/v2/cmdb/system/interface?access_token=<YOUR_ACCESS_TOKEN_HERE>
If you want to get specific interface configuration detail, you can use this request.
https://x.x.x.x/api/v2/cmdb/system/interface/<INTERFACE_NAME>?access_token=<YOUR_ACCESS_TOKEN_HERE>
Created on 05-16-2024 01:17 AM Edited on 05-16-2024 01:17 AM
I think my command is wrong because I always get the same thing despite several syntaxes:
Here is my commands :
#Recovering the token
curl -k -c fgtcookies_fg -d username=apiuser -d secretkey=apiuser https://X.X.X.X/logincheck
#Recovery of Overlay-A interface IP address
curl -s -b fgtcookies_fg -k -X GET -H "Content-Type: application/json" https://X.X.X.X/api/v2/cmdb/system/interface/Overlay-A?access_token=<token>
Hello @Hyjaal ,
I tried with these curl commands, I can get my interface list with no problem.
curl -k -i -X POST https://x.x.x.x/logincheck -d "username=<USER_NAME>&secretkey=<USER_PASSWORD>" --dump-header headers.txt -c cookies.txt
curl -k -i -X GET https://x.x.x.x/api/v2/cmdb/system/interface -b headers.txt
Hello @ozkanaltas,
I confirm that I get the information I want.
I'll find out what's wrong with my order.
Thank you and have a nice day :)
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1740 | |
1108 | |
752 | |
447 | |
240 |
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.