Skip to main content
Rostislav000
Explorer
May 19, 2024 8:48 AM UTC
Solved

How I can send cli command with rest api?

I need to get full configuration from fortigate 600E with REST API. I want to know how send cli command with rest api. Maybe I can use post method for send cli command? Or u tell me other ways to do it with rest api. Thanks 

ozkanaltas
Valued Contributor III
May 19, 2024 9:31 AM UTC

Hello @Rostislav000 ,

 

You can't send cli commands to FortiGate via the API interface. FortiGate API has different API call URLs.

 

If you want to download the backup file via API you can use this request for that. 

 

https://x.x.x.x/api/v2/cmdb/system/config/backup?scope=global&access_token=<Your_ACCESS_TOKEN_HERE>

 

Otherwise, you cannot get the entire configuration as API response output. If you want this, you need to call all API URL from FortiGate.

 

Also, I found one github link about that. You can use it if it works for you.

 

https://github.com/mcarneir0/fortigate-backup-api

5 replies

ozkanaltas
Valued Contributor III
May 19, 2024 9:31 AM UTC

Hello @Rostislav000 ,

 

You can't send cli commands to FortiGate via the API interface. FortiGate API has different API call URLs.

 

If you want to download the backup file via API you can use this request for that. 

 

https://x.x.x.x/api/v2/cmdb/system/config/backup?scope=global&access_token=<Your_ACCESS_TOKEN_HERE>

 

Otherwise, you cannot get the entire configuration as API response output. If you want this, you need to call all API URL from FortiGate.

 

Also, I found one github link about that. You can use it if it works for you.

 

https://github.com/mcarneir0/fortigate-backup-api

Rostislav000
Explorer
May 19, 2024 2:41 PM UTC

I  can check full configuration only with ssh?

ozkanaltas
Valued Contributor III
May 19, 2024 2:43 PM UTC

Yes. You are right. 

Thought Leadership. Security Summit. Thursday, November 12th, PGA National Resort, Palm Beach Gardens, FL.
Security Operations Summit: Modernize SecOps. Operate AI-Native.AMER: November 4 | 9:00 AM PST. India and SAARC: November 5 | 10:00 AM IST. EMEA: November 5 | 10:30 AM CET. APAC: November 5 | 11:00 AM SGT