Fortimail automatic restart using the REST API

A quick example on restarting the Fortimail via REST API using curl.

The Fortimail REST API reference can be found here.


First enable the REST API feature via CLI (on the Fortimail):

config system global
set rest-api enable

Next login via curl and set the cookie to be used in the future:

curl -v -H "Content-Type: application/json" -X POST -d '{"name":"admin","password":"*****"}'-k https://ip_or_host/api/v1/AdminLogin -c cookie.txt

Now issue the restart command:

curl -v -H "Content-Type: application/json" -X POST -d '{"action":1}' -k https://ip_or_host/api/v1/SysStatusCommand --cookie cookie.txt

Leave a Reply