Fos Json Rest Api 523 PDF
Fos Json Rest Api 523 PDF
VERSION 5.2.3
FORTINET DOCUMENT LIBRARY
http://docs.fortinet.com
FORTINET VIDEO GUIDE
http://video.fortinet.com
FORTINET BLOG
https://blog.fortinet.com
CUSTOMER SERVICE & SUPPORT
https://support.fortinet.com
FORTIGATE COOKBOOK
http://cookbook.fortinet.com
FORTINET TRAINING SERVICES
http://www.fortinet.com/training
FORTIGUARD CENTER
http://www.fortiguard.com
FEEDBACK
Email: [email protected]
05-523-270937-201500324
TABLE OF CONTENTS
Change Log 8
Introduction 9
Authentication 9
CSRF Tokens 9
Setting Up an Authenticated Session 10
Supported HTTP methods 10
FortiOS REST API HTTP Response Codes 11
CMDB API 12
URL format 12
Parameters 13
List of Methods 14
collection 15
GET 15
Extra parameters 15
GET: default 16
GET: schema 16
DELETE 16
POST 16
resource 16
GET 17
Extra Parameters 17
PUT 17
PUT: move 17
Extra Parameters 18
POST: clone 18
Extra Parameters 18
DELETE 18
Monitor API 19
URL format 19
Parameters 19
List of Methods 19
firewall 26
health: select 26
local-in: select 26
policy: select 26
policy: reset 27
policy: clear_counters 27
Extra parameters 27
policy6: select 27
policy6: reset 28
policy6: clear_counters 28
Extra parameters 28
session: select 29
Extra parameters 29
session-top: clear_all 29
session-top: close 30
session-top: select 30
Extra parameters 30
shaper: select 31
shaper: reset 31
load-balance: select 31
Extra parameters 32
fortiview 33
statistics: select 33
Extra parameters 33
log 34
status: select 34
Extra parameters 34
status: reset 34
router 35
ipv4: select 35
Extra parameters 35
ipv6: select 35
Extra parameters 36
statistics: select 36
Extra parameters 36
system 38
dashboard: reboot 38
dashboard: shutdown 38
resource: select 38
dhcp: select 39
Extra parameters 39
dhcp: revoke 39
Extra parameters 39
firmware: select 40
firmware: upgrade 40
modem: select 40
modem: reset 40
modem: connect 41
modem: disconnect 41
3g-modem: select 41
sniffer: select 42
sniffer: restart 42
Extra parameters 42
sniffer: start 43
Extra parameters 43
sniffer: stop 43
Extra parameters 43
fsw:select 44
Extra parameters 44
fsw:update 44
interface:select 44
Extra parameters 45
fsw: update 45
interface:select 45
Extra parameters 45
debug:select 46
Extra parameters 46
extender: controller 47
extender: select 47
Extra parameters 47
extender: reset 47
user 48
firewall: select 48
firewall: deauth 48
banned: select 48
banned: clear_users 49
Extra parameters 49
banned: clear_all 49
fortitoken: activate 49
Extra parameters 50
fortitoken: refresh 50
Extra parameters 50
fortitoken: provision 51
Extra parameters 51
utm 52
av: select 52
av: reset 52
web-cat: select 52
web-cat: reset 53
email: select 53
email: reset 53
dlp: select 53
dlp: reset 54
rating-lookup: select 54
Extra parameters 54
app: select 55
app: reset 55
app-lookup: select 55
Extra parameters 56
webfilter 57
override: select 57
override: delete 57
visibility 58
device-type-dist: select 58
Extra parameters 58
device-os-dist: select 58
Extra parameters 59
device-list: select 59
Extra parameters 59
vpn 60
ipsec:select 60
Extra parameters 60
ipsec: tunnel_up 60
Extra parameters 61
ipsec: tunnel_down 61
Extra parameters 61
ipsec: tunnel_reset_stats 61
Extra parameters 62
auto-ipsec: select 62
auto-ipsec: accept 62
auto-ipsec: reject 62
ssl: select 63
ssl: clean_tunnel 63
ssl: delete 63
wanopt 64
peer_stats: select 64
peer_stats: reset 64
webcache 65
stats: select 65
Extra Parameters 65
stats: reset 65
wifi 66
client: select 66
Extra parameters 66
managed_ap: select 66
Extra Parameters 67
managed_ap: set_status 67
ap_status: select 67
interfering_ap: select 67
Extra Parameters 68
euclid: select 68
euclid: reset 68
rogue_ap: select 68
Extra Parameters 69
rogue_ap: clear_all 69
rogue_ap: set_status 69
rogue_ap: restart 70
spectrum: select 70
Extra Parameters 70
Change Log
8 REST API
Fortinet Inc.
Introduction
This document provides the REST API information supported in FortiOS version 5.2.3. This document covers the
FortiOS GUI supported REST API reference only.
l CMDB API
l Retrieve
l Create
l Modify
l Delete objects
l Configuration
l Monitor API
l Monitor dynamic data
l Refresh
l Reset stats
l Reset
l Restart FGT (FortiGate)
Authentication
When making requests to the FortiGate using REST APIs, you will need:
1. A valid authentication token.
2. Appropriate permissions for the requested object.
3. A valid CSRF token (for HTTP POST/PUT/DELETE methods (HTTP GET does not require CSRF token)).
CSRF Tokens
Cross-Site Request Forgery (CSRF) Tokens are alphanumeric values that are passed back-and-forth between client
and server to ensure that a user's form submission does not originate from an offsite document.
This is an important security measure; extra care is needed when submitting direct POST requests to the FortiGate.
The CSRF token must be included in the POST data with the name CSRF_TOKEN, or in the X-CSRFTOKEN HTTP
header.
The value for the token is included as a hidden input named csrftoken on any form rendered by the GUI. It's also
available from the cookie variable ccsrftoken.
Please note that the ccsrftoken cookie variable is only used to pass the token value from
the server to the client, it will not be used to authenticate the request. For authentication the
token must be in the POST data or HTTP headers.
9 REST API
Fortinet Inc.
Supported HTTP methods Introduction
To acquire a valid authentication token, you must make a POST request to the FortiOS login handler with your
administrative login and password.
To setup an authenticated session, make a request to the login request handler with your username and password.
The POST names for these fields are 'username' and 'secretkey' respectively.
If login is successful, the response will contain the authentication token in the APSCOOKIE cookie value. This cookie
value must be included in any further requests.
The permissions for the administrative account you use will affect which objects and operations you'll
have access to, so ensure the user has the permissions required for the actions you wish to perform.
For any action other than GET , a CSRF token must be provided to the API. If the request is submitted
using HTTP POST, the HTTP method can also be overridden using the X-HTTP-Method-Override
HTTP header.
REST API 10
Fortinet Inc.
Introduction FortiOS REST API HTTP Response Codes
FortiOS REST APIs use well-defined HTTP status codes to indicate query results to the API.
403 - Forbidden Request is missing CSRF token or administrato is missing acccess profile
permissions.
405- Method Not Allowed Specified HTTP method is not allowed for this resource.
11 REST API
Fortinet Inc.
CMDB API
FortiOS supports retrieval and modification of CLI configuration using the CMDB API. The CMDB API can be accessed
using the following URL:
https://192.168.1.99/api/v2/cmdb
Request
{
"http_method":"GET"
},
Response
{
"type":"array"
}
},
{
"path":"firewall",
"name":"local-in",
"action":"select",
"access_group":"fwgrp.policy",
"summary":"List implicit and explicit local-in
URL format
For example; to retrieve a list of all configured IPV4 firewall policies use the following URL:
https://192.168.1.99/api/v2/cmdb/firewall/policy/
Or else, you could also retrieve only firewall policy ID 1 using this URL:
https://192.168.1.99/api/v2/cmdb/firewall/policy/1/
The path & name values above directly map to the CLI syntax on FortiOS. The following table lists some of the url,
path, and name retrieved for a CMDB API:
12 REST API
Fortinet Inc.
CMDB API
Parameters
The following optional parameters can be specified for any of the supported APIs.
Additionally, each API may have a list of parameters that are specific to that API. These parameters will
be documented with the individual API methods.
VDOM /api/v2/cmdb/firewall/policy/?vdom=root Use the provided VDOM name for this request
only.
Administrator must have management rights for
the specified VDOM.
REST API 13
Fortinet Inc.
CMDB API
List of Methods
GET default Return the CLI default values for this object
type.
GET schema Return the CLI schema for this object type.
POST
14 REST API
Fortinet Inc.
GET collection
collection
GET
Extra parameters
REST API 15
Fortinet Inc.
resource GET: default
GET: default
Summary Return the CLI default values for this object type.
Action default
GET: schema
Action schema
DELETE
POST
resource
16 REST API
Fortinet Inc.
GET resource
GET
Extra Parameters
PUT
PUT: move
Action move
REST API 17
Fortinet Inc.
resource POST: clone
Extra Parameters
POST: clone
Action clone
Extra Parameters
DELETE
18 REST API
Fortinet Inc.
Monitor API
FortiOS supports retrieval and control of dynamic data using the Monitor API. The monitor API can be accessed using
the following URL:
https://192.168.1.99/api/v2/monitor
URL format
Parameters
The following optional parameters can be specified for any of the supported APIs.
Additionally, each API may have a list of parameters that are specific to that API. These parameters will be
documented with the individual API methods.
List of Methods
19 REST API
Fortinet Inc.
Monitor API
/firewall/session/close/ POST
REST API 20
Fortinet Inc.
Monitor API
/system/firmware/upgrade/ POST
21 REST API
Fortinet Inc.
Monitor API
/system/fsw/update/ POST
/extender-controller/extender/reset/ POST
REST API 22
Fortinet Inc.
Monitor API
/webfilter/override/delete/ POST
23 REST API
Fortinet Inc.
Monitor API
/vpn/auto-ipsec/accept/ POST
/vpn/auto-ipsec/reject/ POST
/vpn/ssl/clean_tunnel/ POST
/vpn/ssl/delete/ POST
REST API 24
Fortinet Inc.
Monitor API
/wifi/managed_ap/set_status/ POST
/wifi/euclid/reset/ POST
/wifi/rogue_ap/clear_all/ POST
/wifi/rogue_ap/set_status/ POST
/wifi/rogue_ap/restart/ POST
25 REST API
Fortinet Inc.
health: select firewall
firewall
health: select
URL /firewall/health/
Action select
local-in: select
URL /firewall/local-in/
Action select
policy: select
URL /firewall/policy/
Action select
REST API 26
Fortinet Inc.
firewall policy: reset
policy: reset
URL /firewall/policy/reset/
Action reset
policy: clear_counters
Summary Reset traffic statistics for one or more IPv4 policies by policy
ID.
URL /firewall/policy/clear_counters/
Action clear_counters
Extra parameters
policy6: select
27 REST API
Fortinet Inc.
policy6: reset firewall
URL /firewall/policy6/
Action select
policy6: reset
Summary Reset traffic statistics for one or more IPv6 policies by policy
ID.
URL /firewall/policy6/reset/
Action reset
policy6: clear_counters
Summary Reset traffic statistics for one or more IPv6 policies by policy
ID.
URL /firewall/policy6/clear_counters/
Action clear_counters
Extra parameters
REST API 28
Fortinet Inc.
firewall session: select
session: select
URL /firewall/session/
Action select
Extra parameters
session-top: clear_all
URL /firewall/session/clear_all/
Action clear_all
29 REST API
Fortinet Inc.
session-top: close firewall
session-top: close
URL /firewall/session/close/
Action close
session-top: select
URL /firewall/session-top/
Action select
Extra parameters
REST API 30
Fortinet Inc.
firewall shaper: select
shaper: select
URL /firewall/shaper/
Action select
shaper: reset
URL /firewall/shaper/reset/
Action reset
load-balance: select
URL /firewall/load-balance/
31 REST API
Fortinet Inc.
load-balance: select firewall
Action select
Extra parameters
REST API 32
Fortinet Inc.
fortiview statistics: select
fortiview
statistics: select
URL /fortiview/statistics/
Action select
Extra parameters
33 REST API
Fortinet Inc.
status: select log
log
status: select
URL /log/stats/
Action select
Extra parameters
status: reset
URL /log/stats/reset/
Action reset
REST API 34
Fortinet Inc.
router ipv4: select
router
ipv4: select
URL /router/ipv4/
Action select
Extra parameters
ipv6: select
URL /router/ipv6/
35 REST API
Fortinet Inc.
statistics: select router
Action select
Extra parameters
statistics: select
URL /router/statistics/
Action select
Extra parameters
REST API 36
Fortinet Inc.
router statistics: select
37 REST API
Fortinet Inc.
dashboard: reboot system
system
dashboard: reboot
URL /system/dashboard/reboot/
Action reboot
dashboard: shutdown
URL /system/dashboard/shutdown/
Action shutdown
resource: select
URL /system/resource/
Action select
REST API 38
Fortinet Inc.
system dhcp: select
dhcp: select
URL /system/dhcp/
Action select
Extra parameters
dhcp: revoke
URL /system/dhcp/revoke/
Action revoke
Extra parameters
39 REST API
Fortinet Inc.
firmware: select system
firmware: select
URL /system/firmware/
Action select
firmware: upgrade
URL /system/firmware/upgrade/
Action upgrade
modem: select
URL /system/modem/
Action select
modem: reset
REST API 40
Fortinet Inc.
system modem: connect
URL /system/modem/reset
Action reset
modem: connect
URL /system/modem/connect/
Action connect
modem: disconnect
URL /system/modem/disconnect/
Action disconnect
3g-modem: select
URL /system/3g-modem/
41 REST API
Fortinet Inc.
sniffer: select system
Action select
sniffer: select
URL /system/sniffer/
Action select
sniffer: restart
URL /system/sniffer/restart/
Action restart
Extra parameters
REST API 42
Fortinet Inc.
system sniffer: start
sniffer: start
URL /system/sniffer/start/
Action start
Extra parameters
sniffer: stop
URL /system/sniffer/stop/
Action stop
Extra parameters
43 REST API
Fortinet Inc.
fsw:select system
fsw:select
URL /system/fsw/
Action select
Extra parameters
fsw:update
URL /system/fsw/update/
Action update
interface:select
URL /system/interface/
Action select
REST API 44
Fortinet Inc.
system fsw: update
Extra parameters
fsw: update
URL /system/fsw/update/
Action update
interface:select
URL /system/interface/
Action select
Extra parameters
45 REST API
Fortinet Inc.
debug:select system
debug:select
URL /system/debug/
Action select
Extra parameters
REST API 46
Fortinet Inc.
extender: controller extender: select
extender: controller
extender: select
URL /extender-controller/extender/
Action select
Extra parameters
extender: reset
URL /extender-controller/extender/reset/
Action reset
47 REST API
Fortinet Inc.
firewall: select user
user
firewall: select
URL /user/firewall/
Action select
firewall: deauth
URL /user/firewall/deauth/
Action deauth
banned: select
URL /user/banned/
Action select
REST API 48
Fortinet Inc.
user banned: clear_users
banned: clear_users
URL /user/banned/clear_users/
Action clear_users
Extra parameters
banned: clear_all
URL /user/banned/clear_all/
Action clear_all
fortitoken: activate
49 REST API
Fortinet Inc.
fortitoken: refresh user
URL /user/fortitoken/activate/
Action activate
Extra parameters
fortitoken: refresh
URL /user/fortitoken/refresh/
Action refresh
ResponseType array
Extra parameters
REST API 50
Fortinet Inc.
user fortitoken: provision
fortitoken: provision
URL /user/fortitoken/provision/
Action provision
Extra parameters
51 REST API
Fortinet Inc.
av: select utm
utm
av: select
URL /utm/av/
Action select
av: reset
URL /utm/av/reset/
Action reset
web-cat: select
URL /utm/web/
Action select
REST API 52
Fortinet Inc.
utm web-cat: reset
web-cat: reset
URL /utm/web/reset/
Action reset
email: select
URL /utm/email/
Action select
email: reset
URL /utm/email/reset/
Action reset
dlp: select
53 REST API
Fortinet Inc.
dlp: reset utm
URL /utm/dlp/
Action select
dlp: reset
URL /utm/dlp/reset/
Action reset
rating-lookup: select
URL /utm/rating-lookup/
Action select
Extra parameters
REST API 54
Fortinet Inc.
utm app: select
app: select
URL /utm/app/
Action select
app: reset
URL /utm/app/reset/
Action reset
app-lookup: select
URL /utm/app-lookup/
Action select
55 REST API
Fortinet Inc.
app-lookup: select utm
Extra parameters
REST API 56
Fortinet Inc.
webfilter override: select
webfilter
override: select
URL /webfilter/override/
Action select
override: delete
URL /webfilter/override/
Action delete
57 REST API
Fortinet Inc.
device-type-dist: select visibility
visibility
device-type-dist: select
URL /visibility/device-type-dist/
Action select
Extra parameters
device-os-dist: select
URL /visibility/device-os-dist/
Action select
REST API 58
Fortinet Inc.
visibility device-list: select
Extra parameters
device-list: select
URL /visibility/device-list/
Action select
Extra parameters
59 REST API
Fortinet Inc.
ipsec:select vpn
vpn
ipsec:select
URL /vpn/ipsec/
Action select
Extra parameters
ipsec: tunnel_up
URL /vpn/ipsec/tunnel_up/
Action tunnel_up
REST API 60
Fortinet Inc.
vpn ipsec: tunnel_down
Extra parameters
ipsec: tunnel_down
URL /vpn/ipsec/tunnel_down/
Action tunnel_down
Extra parameters
ipsec: tunnel_reset_stats
URL /vpn/ipsec/tunnel_reset_stats/
Action tunnel_reset_stats
61 REST API
Fortinet Inc.
auto-ipsec: select vpn
Extra parameters
auto-ipsec: select
URL /vpn/auto-ipsec/
Action select
auto-ipsec: accept
URL /vpn/auto-ipsec/accept/
Action accept
auto-ipsec: reject
URL /vpn/auto-ipsec/reject/
Action reject
REST API 62
Fortinet Inc.
vpn ssl: select
ssl: select
URI /vpn/ssl/
Action select
ssl: clean_tunnel
URI /vpn/ssl/clean_tunnel/
Action clean_tunnel
ssl: delete
URL /vpn/ssl/delete/
Action delete
63 REST API
Fortinet Inc.
peer_stats: select wanopt
wanopt
peer_stats: select
URL /wanopt/peer_stats/
Action select
peer_stats: reset
URL /wanopt/peer_stats/reset/
Action reset
REST API 64
Fortinet Inc.
webcache stats: select
webcache
stats: select
URL /webcache/stats/
Action reset
Extra Parameters
stats: reset
URL /webcache/stats/reset/
Action reset
65 REST API
Fortinet Inc.
client: select wifi
wifi
client: select
URI /wifi/client/
Action select
Extra parameters
managed_ap: select
URL /wifi/managed_ap/
REST API 66
Fortinet Inc.
wifi managed_ap: set_status
Extra Parameters
managed_ap: set_status
URL /wifi/managed_ap/set_status/
Action set_status
ap_status: select
URL /wifi/ap_status/
Action select
interfering_ap: select
URL /wifi/interfering_ap/
67 REST API
Fortinet Inc.
euclid: select wifi
Action select
Extra Parameters
euclid: select
URL /wifi/euclid/
Action select
euclid: reset
URL /wifi/euclid/reset/
Action reset
rogue_ap: select
REST API 68
Fortinet Inc.
wifi rogue_ap: clear_all
URL /wifi/rogue_ap/
Action select
Extra Parameters
rogue_ap: clear_all
URL /wifi/rogue_ap/clear_all
Action clear_all
rogue_ap: set_status
URL /wifi/rogue_ap/set_status/
Action set_status
69 REST API
Fortinet Inc.
rogue_ap: restart wifi
rogue_ap: restart
URL /wifi/rogue_ap/restart/
Action restart
spectrum: select
URL /wifi/spectrum/
Action select
Extra Parameters
REST API 70
Fortinet Inc.
Copyright© 2015 Fortinet, Inc. All rights reserved. Fortinet®, FortiGate®, FortiCare® and FortiGuard®, and certain other marks are registered trademarks of Fortinet, Inc., in
the U.S. and other jurisdictions, and other Fortinet names herein may also be registered and/or common law trademarks of Fortinet. All other product or company names may be
trademarks of their respective owners. Performance and other metrics contained herein were attained in internal lab tests under ideal conditions, and actual performance and
other results may vary. Network variables, different network environments and other conditions may affect performance results. Nothing herein represents any binding
commitment by Fortinet, and Fortinet disclaims all warranties, whether express or implied, except to the extent Fortinet enters a binding written contract, signed by Fortinet’s
General Counsel, with a purchaser that expressly warrants that the identified product will perform according to certain expressly-identified performance metrics and, in such
event, only the specific performance metrics expressly identified in such binding written contract shall be binding on Fortinet. For absolute clarity, any such warranty will be
limited to performance in the same ideal conditions as in Fortinet’s internal lab tests. In no event does Fortinet make any commitment related to future deliverables, features, or
development, and circumstances may change such that any forward-looking statements herein are not accurate. Fortinet disclaims in full any covenants, representations,and
guarantees pursuant hereto, whether express or implied. Fortinet reserves the right to change, modify, transfer, or otherwise revise this publication without notice, and the most
current version of the publication shall be applicable.