Fortinet Document Library

Version:


Table of Contents

New Features

7.0.0
Download PDF
Copy Link

Clear multiple sessions with REST API 7.0.2

The following REST APIs can be used to close multiple IPv4 or IPv6 sessions at once (previously, only a single session could be closed each time):

  • POST https://<FortiGate IP>/api/v2/monitor/firewall/session/close-multiple
  • POST https://<FortiGate IP>/api/v2/monitor/firewall/session6/close-multiple
  • POST https://<FortiGate IP>/api/v2/monitor/firewall/session6/close-all

For more information about the API schemas, refer to the FortiAPI documentation.

api/v2/monitor/firewall/session/close-multiple

POST https://172.18.70.127:443/api/v2/monitor/firewall/session/close-multiple?vdom=vdom2&daddr=***.125.35.134&dport=8&pro=icmp&saddr=192.168.4.158&sport=13045

{'action': 'close-multiple',
 'api_version': 'v7.0',
 'build': 206,
 'http_method': 'POST',
 'http_status': 200,
 'name': 'session',
 'path': 'firewall',
 'serial': 'FG4H1E5*********',
 'status': 'success',
 'vdom': 'vdom2',
 'version': 'v7.0.2'}
Equivalent CLI commands:
# diagnose sys session filter
# diagnose sys session clear

api/v2/monitor/firewall/session6/close-multiple

POST https://172.18.70.127:443/api/v2/monitor/firewall/session6/close-multiple?vdom=vdom2&daddr=2000:172:16:200::254&sport=13176

{'action': 'close-multiple',
 'api_version': 'v7.0',
 'build': 206,
 'http_method': 'POST',
 'http_status': 200,
 'name': 'session6',
 'path': 'firewall',
 'serial': 'FG4H1E5*********',
 'status': 'success',
 'vdom': 'vdom2',
 'version': 'v7.0.2'}
Equivalent CLI commands:
# diagnose sys session6 filter
# diagnose sys session6 clear

api/v2/monitor/firewall/session6/close-all

POST https://172.18.70.127:443/api/v2/monitor/firewall/session6/close-all

{'action': 'close-all',
 'api_version': 'v7.0',
 'build': 206,
 'http_method': 'POST',
 'http_status': 200,
 'name': 'session',
 'path': 'firewall',
 'serial': 'FG4H1E5*********',
 'status': 'success',
 'vdom': 'vdom2',
 'version': 'v7.0.2'}

Error handling

If there is no filter, the REST API backend responds with a 424 error. If there is filter and the filter name is not valid, the REST API backend responds with a 424 error. If there is filter and the filter value does not exist, the REST API backend responds with a 500 error.

Clear multiple sessions with REST API 7.0.2

The following REST APIs can be used to close multiple IPv4 or IPv6 sessions at once (previously, only a single session could be closed each time):

  • POST https://<FortiGate IP>/api/v2/monitor/firewall/session/close-multiple
  • POST https://<FortiGate IP>/api/v2/monitor/firewall/session6/close-multiple
  • POST https://<FortiGate IP>/api/v2/monitor/firewall/session6/close-all

For more information about the API schemas, refer to the FortiAPI documentation.

api/v2/monitor/firewall/session/close-multiple

POST https://172.18.70.127:443/api/v2/monitor/firewall/session/close-multiple?vdom=vdom2&daddr=***.125.35.134&dport=8&pro=icmp&saddr=192.168.4.158&sport=13045

{'action': 'close-multiple',
 'api_version': 'v7.0',
 'build': 206,
 'http_method': 'POST',
 'http_status': 200,
 'name': 'session',
 'path': 'firewall',
 'serial': 'FG4H1E5*********',
 'status': 'success',
 'vdom': 'vdom2',
 'version': 'v7.0.2'}
Equivalent CLI commands:
# diagnose sys session filter
# diagnose sys session clear

api/v2/monitor/firewall/session6/close-multiple

POST https://172.18.70.127:443/api/v2/monitor/firewall/session6/close-multiple?vdom=vdom2&daddr=2000:172:16:200::254&sport=13176

{'action': 'close-multiple',
 'api_version': 'v7.0',
 'build': 206,
 'http_method': 'POST',
 'http_status': 200,
 'name': 'session6',
 'path': 'firewall',
 'serial': 'FG4H1E5*********',
 'status': 'success',
 'vdom': 'vdom2',
 'version': 'v7.0.2'}
Equivalent CLI commands:
# diagnose sys session6 filter
# diagnose sys session6 clear

api/v2/monitor/firewall/session6/close-all

POST https://172.18.70.127:443/api/v2/monitor/firewall/session6/close-all

{'action': 'close-all',
 'api_version': 'v7.0',
 'build': 206,
 'http_method': 'POST',
 'http_status': 200,
 'name': 'session',
 'path': 'firewall',
 'serial': 'FG4H1E5*********',
 'status': 'success',
 'vdom': 'vdom2',
 'version': 'v7.0.2'}

Error handling

If there is no filter, the REST API backend responds with a 424 error. If there is filter and the filter name is not valid, the REST API backend responds with a 424 error. If there is filter and the filter value does not exist, the REST API backend responds with a 500 error.