RESTful API Documentation - Fortinet Docs...

58
APPLICATION DELIVERY CONTROLLER FortiADC E Series Models RESTful API Documentation

Transcript of RESTful API Documentation - Fortinet Docs...

Page 1: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

APPLICATION DELIVERY CONTROLLER

FortiADC™

E Series Models RESTful API Documentation

Page 2: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

RESTful API Documentation FortiADC-E

August 6, 2014

Copyright© 2014 Fortinet, Inc. All rights reserved. Fortinet®, FortiGate®, and FortiGuard®, are registered trademarks of Fortinet, Inc., and other Fortinet names herein may also be trademarks of Fortinet. All other product or company names may be trademarks of their respective owners. Performance metrics contained herein were attained in internal lab tests under ideal conditions, and performance 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 the performance metrics herein. For absolute clarity, any such warranty will be limited to performance in the same ideal conditions as in Fortinet’s internal lab tests. Fortinet disclaims in full any guarantees. 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.

Technical Documentation docs.fortinet.com

Knowledge Base kb.fortinet.com

Customer Service & Support support.fortinet.com

Training Services training.fortinet.com

FortiGuard fortiguard.com

Document Feedback [email protected]

Page 3: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

3

Table of Contents

Change Log ....................................................................................................... 4

Using the RESTful API ...................................................................................... 5

Logging In ................................................................................................................... 5

Clusters ....................................................................................................................... 6

Certificate Revocation Lists (CRLs) .......................................................................... 11

Failover Peers ........................................................................................................... 13

Global Parameters, Upgrade, Reboot ...................................................................... 16

Link Aggregation ....................................................................................................... 25

Match Rules .............................................................................................................. 28

Network Address Translation (NAT) .......................................................................... 32

Responders ............................................................................................................... 34

Routing ..................................................................................................................... 37

Servers ...................................................................................................................... 39

Server Instances ....................................................................................................... 42

Server Pools .............................................................................................................. 45

Subnets ..................................................................................................................... 49

Users ......................................................................................................................... 53

VLANs ....................................................................................................................... 55

Page 4: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 4 RESTful API Documentation FortiADC-E and Equalizer LX

Change Log

Date Change Description

2014-02-25 Initial Release

2014-08-06 Updated ‘Certificate Revocation List’ and ‘Link Aggregation’ add function

Page 5: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E and Equalizer LX

Using the RESTful API

The RESTful API allows you to administer your system remotely by sending HTTP requests to a subnet IP address configured on the load balancer. Similar functionality to that provided by the Command Line Interface (CLI) and the Web UI is available via the RESTful API.

Logging In

The first step in using the API is to log in to the system using a GET request like the one below:

http://<IP_or_FQDN>/rest/10/login?username=touch&password=touch

In the above, <IP_or_FQDN> is the IP address or Fully Qualified Domain Name of an already configured subnet IP address on the system. The HTTP service and/or the HTTPS service must be enabled on that subnet. The username and password used above are the system defaults. The system responds with a string like the one below after a successful login:

{"license":1,"varcrash_dir":1,"cluster":1,"user_ticket":"AEBFA5E87D59B14C03824B26045BF72E","message":"60012010:Login successful.\n","status":0}

The user_ticket returned must be provided in subsequent API calls to identify the user to the system.

The remainder of this document describes the RESTful API function calls you can use after logging in.

Page 6: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 6 RESTful API Documentation FortiADC-E and Equalizer LX

Clusters

• Functions

showList ($obj_class)

add ($obj_class, $request)

detail ($obj_class, $request)

update ($obj_class, $request)

stats ($obj_class, $request)

health ($obj_class, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

******** Cluster Add **********

Method: POST

Request Example: rest/<version>/cluster/<cl01>/

Request & Response format: JSON

Short Description: To add a new "cluster" object in configuration.

Required Parameter(s):

** ip address i.e. "ipaddr" : "x.x.x.x"

** port i.e. "port" : "80"

** type i.e. "type" : "http/https/tcp/udp/l7tcp"

Optional Parameter(s):

--> "sticky_timeout":0

--> "sticky_netmask":32

--> "client_timeout":10

--> "server_timeout":60

--> "connect_timeout":10

--> "custom_header":""

--> "cluster_cert":""

--> "client_ca":""

--> "crl":""

--> "cipherspec":""

--> "validation_depth":0

--> "preferred_peer":""

--> "range":0

--> "idle_timeout":0

Page 7: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 7 RESTful API Documentation FortiADC-E and Equalizer LX

--> "stale_timeout":0

--> "server_pool":""

--> "responder":""

--> "compress_min":1024

--> "compress_types":"text\/*:application\/msword:application...."

--> "cookie_path":""

--> "cookie_domain":""

--> "cookie_generation":0

--> "persist_type":"coyote_cookie_2,none"

--> "cookie_age":0

**** optional flags ****

--> "allow_sslv2":false

--> "allow_sslv3":false

--> "inter_cluster_sticky":false

--> "push_client_cert":false

--> "require_client_cert":false

--> "strict_crl_chain":false

--> "ignore_critical_extns":false

--> "direct_server_return":false

--> "spoof":false

--> "disable":false

--> "allow_utf8":true

--> "once_only":false

--> "abort_server":false

--> "ignore_case":false

--> "rewrite_redirects":false

--> "compress":false

--> "always":false

--> "insert_client_ip":false

--> "tcp_mux":false

Note:

Example- Expecting following JSON in cluster ADD request

JSON string like - { "ipaddr" : "x.x.x.x", "port" : "80", "type" : "tcp", "allow_sslv2":false // optional parameter }.

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ request)

********** Cluster Delete *************

Page 8: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 8 RESTful API Documentation FortiADC-E and Equalizer LX

Method: DELETE

Request Example: rest/<version>/cluster/<cl01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a "cluster" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** Cluster Detail **********

Method: GET

Request Example: rest/<version>/cluster/<cl01>/

Response format: JSON

Short Description: To get the detail of a particular "cluster" instance (i.e. cl01).

Returns:

JSON response with 'status', 'message' and 'data' keys.

• health ($ obj_class, $ request)

********** Cluster Health *************

Method: GET

Request Example: rest/<version>/cluster/<cl01>/health/

Response format: JSON

Short Description: In GET, it will return 'load' value of particular cluster instance i.e. 'cl01'.

Note:

Ex- JSON response would be like - { "status" : "0", "message" : " ", "data" : { "load" : "26.00" }, }

Returns:

JSON response with 'status', 'message' and 'data'.

• showList ($ obj_class)

********** Cluster List *************

Method: GET

Request Example: rest/<version>/cluster/

Response format: JSON

Short Description: To fetch the list of all available "cluster" instances from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• stats ($ obj_class, $ request)

********** Cluster Stats *************

Method: GET

Page 9: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 9 RESTful API Documentation FortiADC-E and Equalizer LX

Request Example: rest/<version>/cluster/<cl01>/stats/

Response format: JSON

Short Description: Default, it will return last <version> minutes stats of a particular cluster instance i.e. 'cl01'.

Excepting optional parameter(s) in Query String.

--> start (epoch)

--> end (epoch)

--> last (in seconds)

Note:

Example 1 - rest/<version>/cluster/<cl01>/stats/?last=300

Example 2 - rest/<version>/cluster/<cl01>/stats/?start=123456&end=123457

Returns:

JSON response with 'status', 'message' and 'data' keys.

• update ($ obj_class, $ request)

******** Cluster Update **********

Method: PUT

Request Example: rest/<version>/cluster/<cl01>/

Short Description: To update an existing instance of the "cluster".

Required Parameter(s):

Note: User can not change readonly parameters.

== type i.e. "type" : "http" (readonly)

== "vid":"1" (readonly)

== "status_rsp":1 (readonly)

== "status_description":"Cluster configuration is incomplete" (readonly)

--> "ipaddr":"192.168.10.123"

--> "port":80

--> "sticky_timeout":0

--> "sticky_netmask":32

--> "client_timeout":10

--> "server_timeout":60

--> "connect_timeout":10

--> "custom_header":""

--> "cluster_cert":""

--> "client_ca":""

--> "crl":""

--> "cipherspec":""

--> "validation_depth":0

--> "preferred_peer":""

Page 10: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 10 RESTful API Documentation FortiADC-E and Equalizer LX

--> "range":0

--> "idle_timeout":0

--> "stale_timeout":0

--> "server_pool":""

--> "responder":""

--> "compress_min":1024

--> "compress_types":"text\/*:application\/msword:application\/postscript"

--> "cookie_path":""

--> "cookie_domain":""

--> "cookie_generation":0

--> "persist_type":"coyote_cookie_2,none"

--> "cookie_age":0

**** optional flags ****

--> "allow_sslv2":false

--> "allow_sslv3":false

--> "inter_cluster_sticky":false

--> "push_client_cert":false

--> "require_client_cert":false

--> "strict_crl_chain":false

--> "ignore_critical_extns":false

--> "direct_server_return":false

--> "spoof":false

--> "disable":false

--> "allow_utf8":true

--> "once_only":false

--> "abort_server":false

--> "ignore_case":false

--> "rewrite_redirects":false

--> "compress":false

--> "always":false

--> "insert_client_ip":false

--> "tcp_mux":false

Note:

Example- Excepting JSON string in following format to modify a particular parameter of a particular cluster.

{ "disable" : true }

Returns:

JSON response with 'status' and 'message'.

Page 11: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 11 RESTful API Documentation FortiADC-E and Equalizer LX

Certificate Revocation Lists (CRLs)

• Functions

showlist ($obj_class)

add ($obj_class, $request)

detail ($obj_class, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

********** CRL Add *************

HTTP Method: POST

Request Example: rest/<version>/crl/<crl01>/

Request & Response format: JSON

Short Description: To add a new "crl" object in the configuration.

Optional Parameter request.

file (upload crl file) (curl client)- curl --http1.0 -v --user touch:touch -X POST -F file=.crl <ADC_URL>/rest/<version>/crl/<crl01>/

Blank JSON parameter is required when no parameters are being sent in the request. Example- {"":""}

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ request)

********** CRL Delete *************

Method: DELETE

Request Example: rest/<version>/crl/<crl01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a "crl" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** CRL Detail **********

HTTP Method: GET

Request Example: rest/<version>/crl/<crl01>/

Response format: JSON

Page 12: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 12 RESTful API Documentation FortiADC-E and Equalizer LX

Short Description: To get the detail of a particular "crl" <crl01> instance.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showlist ($ obj_class)

********** CRL List *************

Method: GET

Request Example: rest/<version>/crl/

Response format: JSON

Description: To fetch the list of all available "crl" instances from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

Page 13: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 13 RESTful API Documentation FortiADC-E and Equalizer LX

Failover Peers

• Functions

showlist ($obj_class)

add ($obj_class, $request)

detail ($obj_class, $request)

update ($obj_class, $request)

status ($obj_class, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

********** Peer Add *************

HTTP Method: POST

Request Example: rest/<version>/peer/<pr01>/

Request & Response format: JSON

Short Description: To add a new "peer" object in the configuration.

Required Parameter(s) in request.

** "signature":"1RBCB3283EBE860BE5DB8B4DEBCA........"

Optional Parameter(s) in request.

--> "os8_intip":""

--> "sysid":""

--> "recv_timeout":2

--> "conn_timeout":1

--> "heartbeat_interval":2

--> "retry_interval":5

--> "strike_count":3

--> "failover":false

--> "active_active":false

--> "preferred_primary":false

--> "fo_config_xfer":true

--> "peer_os8":false

Note:

Example- Expecting following JSON in peer ADD request

{ "signature" : "xxxx", }

Returns:

JSON response with 'status' and 'message'.

Page 14: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 14 RESTful API Documentation FortiADC-E and Equalizer LX

• delete ($ obj_class, $ request)

********** Peer Delete *************

Method: DELETE

Request Example: rest/<version>/peer/<pr01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a "peer" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** Peer Detail **********

HTTP Method: GET

Request Example: rest/<version>/peer/<pr01>/

Response format: JSON

Short Description: To get the detail of a particular "peer" <pr01> instance.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showlist ($ obj_class)

********** Peer List *************

Method: GET

Request Example: rest/<version>/peer/

Response format: JSON

Description: To fetch the list of all available "peer" instances from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• status ($ obj_class, $ request)

******** Peer Status **********

Method: GET

Request: rest/<version>/peer/<pr01>/status/

Response format: JSON

Short Description: To get the status of a particular "peer" instance <pr01>.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• update ($ obj_class, $ request)

********** Peer Update *************

HTTP Method: PUT

Page 15: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 15 RESTful API Documentation FortiADC-E and Equalizer LX

Request Example: rest/<version>/peer/<pr01>/

Request & Response format: JSON

Short Description: To update a particular existing instance <pr01> of a "peer" object.

Parameters

== "sequence":"" (readonly)

== "sysid":"" (readonly)

== "signature":"1RBCB3283EBE860BE5DB8B4DEBCA5A8AB...." (readonly)

--> "new_name": "abcd" // for changing peer's name

--> "failover":false

--> "active_active":false

--> "preferred_primary":false

--> "fo_config_xfer":true

--> "peer_os8":false

--> "os8_intip":""

--> "recv_timeout":2

--> "conn_timeout":1

--> "heartbeat_interval":2

--> "retry_interval":5

--> "strike_count":3

Note:

Example- Excepting JSON string in following format to modify a particular parameter of a particular peer.

{"failover_group" : "TRUE"}

Returns:

JSON response with 'status' and 'message'.

Page 16: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 16 RESTful API Documentation FortiADC-E and Equalizer LX

Global Parameters, Upgrade, Reboot

• Functions

info ($obj_class)

*** RESTful method - ADC Global Info ***

arp_list ($obj_class)

*** RESTful method - ADC Global arp ***

systemtime ($obj_class)

*** RESTful method - ADC (System) Time (current time in epoch) ***

upgrade ($obj_class)

*** RESTful method - ADC Upgrade ***

upgradeStatus ($obj_class, $request)

*** RESTful method - ADC Upgrade Status ***

reboot ($obj_class, $request)

*** RESTful method - Reboot ADC ***

upgradeLog ($obj_class, $request)

*** RESTful method - ADC Upgrade Log ***

stats ($obj_class, $request)

*** RESTful method - CPU & Memory Statistic ***

detail ($obj_class)

*** RESTful method - ADC Global Parameters ***

syslogState ($obj_class, $request)

*** RESTful method - To set remote syslog server Enable/Disable ***

syslogServer ($obj_class, $request)

*** RESTful method - To set remote syslog server IP ***

deleteSyslogServer ($obj_class)

Page 17: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 17 RESTful API Documentation FortiADC-E and Equalizer LX

*** RESTful method - To unset remote syslog server IP ***

eventLog ($obj_class, $request)

*** RESTful method - Logging ***

listInterfacePort ($obj_class)

detailInterfacePort ($obj_class, $request)

statsInterfacePort ($obj_class, $request)

updateInterfacePort ($obj_class, $request)

backup ($obj_class, $request)

restore ($obj_class, $request)

• Detailed Description

RESTful 'global' API.

Author:

Sachin Maheshwari

Copyright 2013 Coyote Point Systems, Inc. All rights reserved.

• Function Documentation

• arp_list ($ obj_class)

*** RESTful method - ADC Global arp ***

Method: GET

Request Example: rest/<version>/arp

Response format: JSON

Short Description: To get ARP Table of the ADC.

Returns:

JSON Response Example - {"message":"60037062: Get ARP information successfully completed.", "status":0, "data":[{ "IP":"1.2.3.94", "MAC":"00:0c:29:05:5c:43", "Interface":"wm0" } ] }

• backup ($ obj_class, $ request)

********** Backup *************

Method: GET

Request Example: rest/<version>/backup/

Short Description: To take the backup of the configuration.

Request (Query String) Parameter(s)

Page 18: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 18 RESTful API Documentation FortiADC-E and Equalizer LX

mode Ftp ** url - FTP URL (required in case of FTP backup) --> name - backup file name (optional)

Example - If 'name' is 'friday_bk', system will add '.cps' automatically and finally backup file name will be 'friday_bk.cps'.

mode Local - ** name - FILE NAME Example - if name is 'friday_bk' ,system will add '.cps' automatically and finally backup file name will be 'friday_bk.cps'.

Request Example: rest/<version>/backup/?name=FILE NAME

Note:

default is 'local'.

in case of 'FTP', log will come in 'out_buf'.

Returns:

JSON response with 'status' ,'message' and 'out_buf'.

• deleteSyslogServer ($ obj_class)

*** RESTful method - To unset remote syslog server IP ***

Method: DELETE

Request Example: rest/<version>/syslog-server/

Response format: JSON

Short Description: To unset remote syslog server ip.

Returns:

JSON response

• detail ($ obj_class)

*** RESTful method - ADC Global Parameters ***

Method: GET

Request Example: rest/<version>/global/

Response format: JSON

Short Description: To get default global information of the ADC.

Returns:

JSON Response Example -

• detailInterfacePort ($ obj_class, $ request)

********** Interface Port Detail *************

Method: GET

Request Example: rest/<version>/interface/if01/

Response format: JSON

Description: To get the detail of a particular interface's port. Example - {"message":"60021021: Received 2 interfaces.",

"status":0,

"data":{

Page 19: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 19 RESTful API Documentation FortiADC-E and Equalizer LX

"Autonegotiation Mode":"full",

// <full |select| force> "Duplex Mode":"full",

// <half | full> "Speed":1000,

// <10 | 100| 1000> "Status":0,

"Maximum MTU":9000

}

}

Returns:

JSON response with 'status', 'message' and 'data'(array).

• eventLog ($ obj_class, $ request)

*** RESTful method - Logging ***

Method: DELETE

Request Example: rest/<version>/log/

Response format: JSON

Short Description: To get the events log.

Optional parameters in query string in request.

Excepting optional parameter(s) in Query String.

--> type (sys|audit) - default is eqlog

--> start (epoch)

--> end (epoch)

--> last (in seconds)

--> reverse (0|1) - default is 1

--> lines

Note:

Example 1 - rest/<version>/stats/?last=300

Example 2 - rest/<version>/stats/?type=sys&last=300

Example 3- rest/<version>/stats/?start=123456&end=123457

Example 4 - rest/<version>/stats/?type=audit&reverse=0

Example 5 - rest/<version>/stats/?lines=5

by default (if there are no parameters in query string) it will return maximum 100 lines of 'eq' log.

Returns:

JSON response

• info ($ obj_class)

*** RESTful method - ADC Global Info ***

Method: GET

Page 20: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 20 RESTful API Documentation FortiADC-E and Equalizer LX

Request Example: rest/<version>/

Response format: JSON

Short Description: To get default global information of the ADC.

Returns:

JSON Response Example - {"message":"60001201: Global version get successfully.", "status":0, "data": { "FirmwareVersion":"10.1.0a", "FirmwareTag":"none", "SystemBrand":"ADC", "SystemType":"E650GX", "SystemRevision":1, "SystemSerialNumber":"A099A-17009", "SystemID":"003048BB6B28", "HardwareFeatures":"Hardware Compression, Hardware SSL Acceleration", "SwitchType":"CP301", "SwitchCount":1 }, "gsn":84774 }

• listInterfacePort ($ obj_class)

********** Interface Port List *************

Method: GET

Request Example: rest/<version>/interface/

Response format: JSON

Description: List the interface ports.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• reboot ($ obj_class, $ request)

*** RESTful method - Reboot ADC ***

Method: GET

Request Example: rest/<version>/reboot/

Response format: JSON

Short Description: To reboot the ADC.

Returns:

JSON Response Example - { "message":"60001179: Reboot successfully.", "status":0 }

• restore ($ obj_class, $ request)

********** Restore *************

Method: POST

Request Example: rest/<version>/restore/

Short Description: To restore the configuration from archive.

Request Parameter(s)

mode FTP - ** url - FTP URL (required in case of restore from FTP server) ** name - backup file name (required in case of restore from FTP server)

mode Local - ** upload local file as a 'file' parameter Example ('local' with CURL client) -

curl --http1.0 -v --user touch:touch -X POST -F file=-Sep-18-13_07-24-25-backup.cps <ADC_URL>/rest/<version>/restore/

Note:

after getting 200 response system will be rebooted automatically.

Page 21: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 21 RESTful API Documentation FortiADC-E and Equalizer LX

Returns:

JSON response with 'status' and 'message'.

• stats ($ obj_class, $ request)

*** RESTful method - CPU & Memory Statistic ***

Method: GET

Request Example: rest/<version>/stats/

Response format: JSON

Short Description: Default (without any optional parameters in query string), it will return last 10 minutes stats of CPU and Memory.

Excepting optional parameter(s) in Query String.

--> start (epoch)

--> end (epoch)

--> last (in seconds)

Note:

Example 1 - rest/<version>/stats/?last=300

Example 2 - rest/<version>/stats/?start=123456&end=123457

Returns:

JSON Response Example - { "status":"0", "message":"60001292: eqlog read completed.", "data":["Time,CPU utilization,Free Memory,Total Memory", "2013-09-10T09:23:20,3.30,435560448.00,536408064.00"] }

• statsInterfacePort ($ obj_class, $ request)

********** Interface Port Stats *************

Method: GET

Request Example: rest/<version>/interface/if01/stats/

Response format: JSON

Description: To get the statistics of a particular interface's port.

Response Example - { "message":"60021027: Switch.....",

"status":0,

"data":{

"rx_cntr": // Received Counters

[{"rx_cntr_id":0,"rx_cntr_value":0,.....],

"tx_cntr": // Transmitted Counters

[{"tx_cntr_id":0,"tx_cntr_value":0,.....]

}}

Returns:

JSON response with 'status', 'message' and 'data'(array).

• syslogServer ($ obj_class, $ request)

Page 22: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 22 RESTful API Documentation FortiADC-E and Equalizer LX

*** RESTful method - To set remote syslog server IP ***

Method: PUT

Request Example: rest/<version>/syslog-server/

Response format: JSON

Short Description: To set remote syslog server ip. Parameter in request.

syslog-server: "x.x.x.x" - Expecting JSON request like -

{"syslog-server": "x.x.x.x"}

Returns:

JSON response

• syslogState ($ obj_class, $ request)

*** RESTful method - To set remote syslog server Enable/Disable ***

Method: PUT

Request Example: rest/<version>/syslog/

Response format: JSON

Short Description: To enable or disable remote syslog server.

Parameter in request.

syslog: true (boolean) - Expecting JSON request like -

{"syslog":false}

Returns:

JSON response

• systemtime ($ obj_class)

*** RESTful method - ADC (System) Time (current time in epoch) ***

Method: GET

Request Example: rest/<version>/time/

Response format: JSON

Short Description: To get ADC current time (in epoch).

Returns:

JSON Response Example - { "status":0, "message":"", "data":{"current_time":1377669666} }

• updateInterfacePort ($ obj_class, $ request)

********** Modify Interface Port *************

Method: PUT

Request Example: rest/<version>/interface/if01/

Response format: JSON

Parameter(s)

Page 23: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 23 RESTful API Documentation FortiADC-E and Equalizer LX

--> "autonegotiation" : "full", --> "speed" : 1000, --> "duplex" : "full"

Example JSON request - {"autonegotiation": "half"}

Description: To change the particular interface's port parameter

Returns:

JSON response with 'status' and 'message'.

• upgrade ($ obj_class)

*** RESTful method - ADC Upgrade ***

Method: POST

Request Example: rest/<version>/uprade/

Response format: JSON

Short Description: To upgrade ADC with new release.

Required Parameter in request (multipart/form-data).

** file Example (through CURL client)-

curl --http1.0 -v --user username:password -X POST -F file=.tgz <ADC_URL>/rest/<version>/upgrade

Returns:

JSON Response Example - { "data":{"session_id":"139762"}, "status":0, "message":"60001303: GUI installation successfully started." }

• upgradeLog ($ obj_class, $ request)

*** RESTful method - ADC Upgrade Log ***

Method: GET

Request Example: rest/<version>/upgrade/log/

Response format: JSON

Short Description: To get upgrade log.

Returns:

JSON Response Example - { "data":{"rows":["Started upgrade script at Wed Jan 29 19:54:50 UTC 2014 with the following parameters:

","..........]}, "message":"", "status":0 }

• upgradeStatus ($ obj_class, $ request)

*** RESTful method - ADC Upgrade Status ***

Method: GET

Request Example: rest/<version>/upgrade/status/?session_id=139762

Response format: JSON

Description: To check upgrade progress.

Required Parameter: **session_id.

Page 24: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 24 RESTful API Documentation FortiADC-E and Equalizer LX

Returns:

JSON Response Example - { "data":{ "buffer":"%%% 100: Upgrade successfully...\n\n", "finish":1 }, "message": "60001382: FIFO read successfully completed.", "status":0 }

Page 25: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 25 RESTful API Documentation FortiADC-E and Equalizer LX

Link Aggregation

• Functions

showlist ($obj_class)

add ($obj_class, $request)

attachInterface ($obj_class, $parent_name, $request)

detail ($obj_class, $request)

update ($obj_class, $request)

detachInterface ($obj_class, $parent_name, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

********** Aggregation Add *************

HTTP Method: POST

Request Example: rest/<version>/agr/<agr01>/

Request & Response format: JSON

Short Description: To add a new "agr" object in the configuration.

Optional Parameter(s) in request.

--> Link Aggregation Control Protocol "lacp":0

Note:

Example- Expecting following JSON in agr ADD request

{ "lacp" : "0" // optional parameter }

Blank JSON parameter is required when no parameters are being sent in the request. Example- {"":""}

Returns:

JSON response with 'status' and 'message'.

• attachInterface ($ obj_class, $ parent_name, $ request)

********** Attach Interface *************

HTTP Method: POST

Request Example: rest/<version>/agr/<agr01>/interface/<if01>/

Response format: JSON

Short Description: To attach an interface instance to a particular "agr" object in the configuration.

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ request)

Page 26: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 26 RESTful API Documentation FortiADC-E and Equalizer LX

********** Aggregation Delete *************

Method: DELETE

Request Example: rest/<version>/agr/<agr01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a "agr" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detachInterface ($ obj_class, $ parent_name, $ request)

********** Detach Interface *************

Method: DELETE

Request Example: rest/<version>/agr/<agr01>/interface/<if01>/?<force=1>

Response format: JSON

Short Description: To detach an existing interface (if01) from a particular "agr" object (agr01).

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** Aggregation Detail **********

HTTP Method: GET

Request Example: rest/<version>/agr/<agr01>/

Response format: JSON

Short Description: To get the detail of a particular "agr" <agr01> instance.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showlist ($ obj_class)

********** Aggregation List *************

Method: GET

Request Example: rest/<version>/agr/

Response format: JSON

Description: To fetch the list of all available "agr" instances from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• update ($ obj_class, $ request)

********** Aggregation Update *************

Page 27: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 27 RESTful API Documentation FortiADC-E and Equalizer LX

HTTP Method: PUT

Request Example: rest/<version>/agr/<agr01>/

Request & Response format: JSON

Short Description: To update a particular existing instance <agr01> of a "agr" object.

Parameters

== "sequence":"" (readonly)

== "num_ifis":1 (readonly)

== "interfaces":["if06"] (readonly)

== "lacp" : "true"

Note:

Example- Excepting JSON string in following format to modify a particular parameter of a particular agr.

{"lacp" : "0"}

Returns:

JSON response with 'status' and 'message'.

Page 28: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 28 RESTful API Documentation FortiADC-E and Equalizer LX

Match Rules

• Functions

showList ($obj_class, $parent_name)

add ($obj_class, $parent_name, $request)

detail ($obj_class, $parent_name, $request)

update ($obj_class, $parent_name, $request)

stats ($obj_class, $parent_name, $request)

delete ($obj_class, $parent_name, $request)

• Function Documentation

• add ($ obj_class, $ parent_name, $ request)

********** Match Add *************

HTTP Method: POST

Request Example: rest/<version>/cluster/<cl01>/match/<ma01>/

Request & Response format: JSON

Short Description: To associate a particular match rule (ma01) with a particular cluster (cl01).

Required Parameter(s) in request.

** "next":"none"

Optional Parameter(s) in request.

--> "persist_type":"coyote_cookie_2,none"

--> "cookie_generation":0, --> "cookie_age":0, --> "cookie_path":""

--> "cookie_domain":""

--> "server_pool":""

--> "responder":""

--> "compress_min":1024, --> "compress_types":"text\/*:application\/msword:application..."

--> "expression":""

--> "spoof":false

--> "once_only":false

--> "abort_server":false

--> "ignore_case":false

--> "disable":true

--> "rewrite_redirects":false

--> "compress":false

--> "cookie_always":false

--> "insert_client_ip":false

--> "tcp_mux":false

Page 29: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 29 RESTful API Documentation FortiADC-E and Equalizer LX

Note:

Example- Expecting following JSON in match ADD request

{ "next" : "null", "disable" : "true" // optional parameter }

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ parent_name, $ request)

********** Match Delete *************

Method: DELETE

Request Example: rest/<version>/cluster/<cl01>/match/<ma01>/?<force=1>

Response format: JSON

Short Description: To delete a particular existing match rule <ma01> which would be associated with a particular cluster "cl01".

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ parent_name, $ request)

******** Match Detail **********

HTTP Method: GET

Request Example: rest/<version>/cluster/<cl01>/match/<ma01>/

Response format: JSON

Short Description: To get the detail of a particular "match" <ma01> instance which would be associated with a particular cluster "cl01".

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showList ($ obj_class, $ parent_name)

********** Match List *************

Method: GET

Request Example: rest/<version>/cluster/<cl01>/match/

Response format: JSON

Description: To fetch the list of all associated "match" instances of a particular cluster "cl01".

Returns:

JSON response with 'status', 'message' and 'data'(array).

• stats ($ obj_class, $ parent_name, $ request)

********** Match Stats *************

Method: GET

Request Example: rest/<version>/cluster/<cl01>/match/<ma01>/stats/

Response format: JSON

Page 30: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 30 RESTful API Documentation FortiADC-E and Equalizer LX

Short Description: Default, it will return last 10 minutes stats of a particular "match" instance i.e. 'ma01' which would be associated with a particular cluster "cl01".

Excepting optional parameter(s) in Query String.

--> start (epoch)

--> end (epoch)

--> last (in seconds)

Note:

Example 1 - rest/<version>/cluster/<cl01>/match/<ma01>/stats/?last=300

Example 2 - rest/<version>/cluster/<cl01>/match/<ma01> /stats/?start=123456&end=123457

Returns:

JSON response with 'status', 'message' and 'data' keys.

• update ($ obj_class, $ parent_name, $ request)

********** Match Update *************

HTTP Method: PUT

Request Example: rest/<version>/cluster/<cl01>/match/<ma01>/

Request & Response format: JSON

Short Description: To update a particular existing instance <ma01> which would be associated with a particular cluster "cl01".

Parameters

== "sequence":""

== "clname":"cl02"

--> "next":"none"

--> "persist_type":"coyote_cookie_2,none"

--> "cookie_generation":0, --> "cookie_age":0, --> "cookie_path":""

--> "cookie_domain":""

--> "server_pool":""

--> "responder":""

--> "compress_min":1024, --> "compress_types":"text\/*:application\/msword:application..."

--> "expression":""

--> "spoof":false

--> "once_only":false

--> "abort_server":false

--> "ignore_case":false

--> "disable":true

--> "rewrite_redirects":false

--> "compress":false

--> "cookie_always":false

--> "insert_client_ip":false

Page 31: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 31 RESTful API Documentation FortiADC-E and Equalizer LX

--> "tcp_mux":false

Note:

Example- Excepting JSON string in following format to modify a particular parameter of an associated "match" with a particular serevr pool "cl01".

{"spoof" : "1", "once_only" : "1"}

Returns:

JSON response with 'status' and 'message'.

Page 32: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 32 RESTful API Documentation FortiADC-E and Equalizer LX

Network Address Translation (NAT)

• Functions

showList ($obj_class, $name, $parent_name)

add ($obj_class, $parent_name, $request)

delete ($obj_class, $parent_name, $request)

• Function Documentation

• add ($ obj_class, $ parent_name, $ request)

********** NAT Add *************

HTTP Method: POST

Request Example: rest/<version>/vlan/<vlan>/subnet/<subnet>/nat

Request & Response format: JSON

Short Description: To associate a particular NAT (x.x.x.x) with a particular subnet (<subnet>).

Required Parameter(s) in request.

** "from_ip":"x.x.x.x"

** "out_ip":"x.x.x.x"

Note:

Example- Expecting following JSON in NAT ADD request

{ "from_ip" : "x.x.x.x",

"out_ip" : "x.x.x.x" }

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ parent_name, $ request)

********** NAT Delete *************

Method: DELETE

Request Example: rest/<version>/vlan/<vlan>/subnet/<subnet>/nat/?<force=1>

Response format: JSON

Short Description: To delete a particular existing NAT which would be associated with a particular subnet "<subnet>".

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Note:

Example- Expecting following JSON in NAT Delete request

{ "from_ip" : "x.x.x.x",

"out_ip" : "x.x.x.x" }

Returns:

Page 33: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 33 RESTful API Documentation FortiADC-E and Equalizer LX

JSON response with 'status' and 'message'.

• showList ($ obj_class, $ name, $ parent_name)

********** NAT List *************

Method: GET

Request Example: rest/<version>/vlan/<vlan>/subnet/<subnet>/nat

Response format: JSON

Description: To fetch the list of all associated "NAT" of a particular subnet <subnet>.

Returns:

JSON response with 'status', 'message' and 'data'(array).

Page 34: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 34 RESTful API Documentation FortiADC-E and Equalizer LX

Responders

• Functions

showlist ($obj_class)

add ($obj_class, $request)

detail ($obj_class, $request)

update ($obj_class, $request)

stats ($obj_class, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

********** Responder Add *************

HTTP Method: POST

Request Example: rest/<version>/resp/<resp01>/

Request & Response format: JSON

Short Description: To add a new "responder" object in the configuration.

Required Parameter(s) 'sorry' responder in request.

** "type":"sorry", ** "html_data":"<h1>coming soon...</h1>"

Required Parameter(s) in 'redirect' responder request.

** "type":"redirect"

** "url":"http://abc.com"

** "status_code":302

** "status_desc":""

Optional Parameter in 'redirect' responder request.

--> "regex":""

Note:

Example 1- Expecting following JSON in responder ADD request if responder type 'redirect'.

{ "type" : "redirect", "url" : "http://abc.com", "status_code" : "303", "status_desc" : "xyz" }

Example 2- Expecting following JSON in responder ADD request if responder type 'sorry'.

{ "type" : "sorry", "html_data" : "<h1>...</h1>" }

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ request)

********** Responder Delete *************

Method: DELETE

Request Example: rest/<version>/resp/<resp01>/?<force=1>

Page 35: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 35 RESTful API Documentation FortiADC-E and Equalizer LX

Response format: JSON

Short Description: To delete an existing instance of a "responder" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** Responder Detail **********

HTTP Method: GET

Request Example: rest/<version>/resp/<resp01>/

Response format: JSON

Short Description: To get the detail of a particular "responder" <resp01> instance.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showlist ($ obj_class)

********** Responder List *************

Method: GET

Request Example: rest/<version>/resp/

Response format: JSON

Description: To fetch the list of all available "resp" instances from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• stats ($ obj_class, $ request)

********** Responder Stats *************

Method: GET

Request Example: rest/<version>/resp/<resp01>/stats/

Response format: JSON

Short Description: Default, it will return last 10 minutes stats of a particular responder instance i.e. 'resp01'.

Excepting optional parameter(s) in Query String.

--> start (epoch)

--> end (epoch)

--> last (in seconds)

Note:

Example 1 - rest/<version>/resp/<resp01>/stats/?last=300

Example 2 - rest/<version>/resp/<resp01>/stats/?start=123456&end=123457

Returns:

JSON response with 'status', 'message' and 'data' keys.

Page 36: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 36 RESTful API Documentation FortiADC-E and Equalizer LX

• update ($ obj_class, $ request)

********** Responder Update *************

HTTP Method: PUT

Request Example: rest/<version>/resp/<resp01>/

Request & Response format: JSON

Short Description: To update a particular existing instance <resp01> of a "resp" object.

Parameters

== "sequence":""

== "status_rsp":2

== "status_description":"Responder is not referenced by any objects"

--> "type":"sorry"

--> "status_code":-1

--> "status_desc":""

--> "url":""

--> "regex":""

--> "html_data":"sdfsdafsfsad"

Note:

Example- Excepting JSON string in following format to modify a particular parameter of a particular resp.

{"html_data" : "<h2>...</h2>" }

Returns:

JSON response with 'status' and 'message'.

Page 37: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 37 RESTful API Documentation FortiADC-E and Equalizer LX

Routing

• Functions

showList ($obj_class, $name, $parent_name)

add ($obj_class, $parent_name, $request)

update ($obj_class, $parent_name, $request)

delete ($obj_class, $parent_name, $request)

• Function Documentation

• add ($ obj_class, $ parent_name, $ request)

********** Route Add *************

HTTP Method: POST

Request Example: rest/<version>/vlan/<vlan>/subnet/<subnet>/route

Request & Response format: JSON

Short Description: To associate a particular Route (x.x.x.x) with a particular subnet (<subnet>).

Required Parameter(s) in request.

** "dst_ip":"x.x.x.x"

** "gateway":"x.x.x.x" Optional Parameter(s) in request.

--> "src_ip":"x.x.x.x"

--> "prefer":fasle

Note:

Example- Expecting following JSON in Route ADD request

{ "dst_ip" : "x.x.x.x",

"src_ip" : "x.x.x.x",

//optional parameter "gateway" : "x.x.x.x",

"prefer" : false/true // optional parameter }

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ parent_name, $ request)

********** Route Delete *************

Method: DELETE

Request Example: rest/<version>/vlan/<vlan>/subnet/<subnet>/route/?<force=1>

Response format: JSON

Short Description: To delete a particular existing Route which would be associated with a particular subnet "<subnet>".

Expecting optional parameter in Query String

Page 38: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 38 RESTful API Documentation FortiADC-E and Equalizer LX

--> force flag i.e. "force" = "1" (optional)

Note:

Example- Expecting following JSON in Route Delete request

{ "dst_ip" : "x.x.x.x",

"src_ip" : "x.x.x.x" }

Returns:

JSON response with 'status' and 'message'.

• showList ($ obj_class, $ name, $ parent_name)

********** Route List *************

Method: GET

Request Example: rest/<version>/vlan/<vlan>/subnet/<subnet>/route

Response format: JSON

Description: To fetch the list of all associated "Route" of a particular subnet <subnet>.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• update ($ obj_class, $ parent_name, $ request)

********** Route Modify *************

HTTP Method: PUT

Request Example: rest/<version>/vlan/<vlan>/subnet/<subnet>/route

Request & Response format: JSON

Short Description: To associate a particular Route (x.x.x.x) with a particular subnet (<subnet>).

Required Parameter(s) in request.

** "dst_ip":"x.x.x.x"

** "gateway":"x.x.x.x"

Optional Parameter(s) in request.

--> "src_ip":"x.x.x.x"

--> "prefer":fasle

Note:

Example- Expecting following JSON in Route Modify request

{ "dst_ip" : "x.x.x.x",

"src_ip" : "x.x.x.x",

"gateway" : "x.x.x.x",

"prefer" : false/true // optional parameter }

Returns:

JSON response with 'status' and 'message'.

Page 39: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 39 RESTful API Documentation FortiADC-E and Equalizer LX

Servers

• Functions

showlist ($obj_class)

add ($obj_class, $request)

detail ($obj_class, $request)

update ($obj_class, $request)

stats ($obj_class, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

********** Server Add *************

HTTP Method: POST

Request Example: rest/<version>/server/<sv01>/

Request & Response format: JSON

Short Description: To add a new "server" object in the configuration.

Required Parameter(s) in request.

** ip address i.e. "ipaddr" : "x.x.x.x"

** port i.e. "port" : "80"

** protocol i.e. "proto" : "tcp"

Optional Parameter(s) in request.

--> "max_reuse_conn":0

--> "reuse_conn_timeout":0

--> "probe_l3":true

--> "vlb_manager":""

--> "vlb_uuid":""

--> "name":"sv01"

--> "vid":"unassigned"

Note:

Example- Expecting following JSON in server ADD request

{ "ipaddr" : "x.x.x.x", "port" : "80", "proto" : "tcp", "probe_l3" : 1 // optional parameter }

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ request)

********** Server Delete *************

Method: DELETE

Page 40: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 40 RESTful API Documentation FortiADC-E and Equalizer LX

Request Example: rest/<version>/server/<sv01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a "server" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** Server Detail **********

HTTP Method: GET

Request Example: rest/<version>/server/<sv01>/

Response format: JSON

Short Description: To get the detail of a particular "server" <sv01> instance.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showlist ($ obj_class)

********** Server List *************

Method: GET

Request Example: rest/<version>/server/

Response format: JSON

Description: To fetch the list of all available "server" instances from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• stats ($ obj_class, $ request)

********** Server Stats *************

Method: GET

Request Example: rest/<version>/server/<sv01>/stats/

Response format: JSON

Short Description: Default, it will return last 10 minutes stats of a particular server instance i.e. 'sv01'.

Excepting optional parameter(s) in Query String.

--> start (epoch)

--> end (epoch)

--> last (in seconds)

Note:

Example 1 - rest/<version>/server/<sv01>/stats/?last=300

Example 2 - rest/<version>/server/<sv01>/stats/?start=123456&end=123457

Returns:

Page 41: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 41 RESTful API Documentation FortiADC-E and Equalizer LX

JSON response with 'status', 'message' and 'data' keys.

• update ($ obj_class, $ request)

********** Server Update *************

HTTP Method: PUT

Request Example: rest/<version>/server/<sv01>/

Request & Response format: JSON

Short Description: To update a particular existing instance <sv01> of a "server" object.

Parameters

== "sequence":"" (readonly)

== protocol i.e. "porto" : "tcp" (readonly)

== VLAN ID i.e. "vid" : "1" (readonly)

== status i.e. "status_resp" : 1/2 (readonly)

== status description i.e. "status_description" : "Server is not used by any instances" (readonly)

--> ip address i.e. "ipaddr" : "x.x.x.x" (optional)

--> port i.e. "port" : "80" (optional)

--> maximum reused connections i.e. "max_reus_conn" : 0 (optional)

--> reused connection timeout i.e. "reuse_conn_timeout" : 0 (optional)

--> ICMP probing flag i.e. "probe_l3" : 0 (optional)

--> VLB manager i.e. "vlb_manager" : "xyz" (optional)

--> virtual server id i.e. "vlb_uuid" : "xyz1234" (optional)

Note:

Example- Excepting JSON string in following format to modify a particular parameter of a particular server.

{"port" : "80"} OR {"ipaddr" : "y.y.y.y" }

Returns:

JSON response with 'status' and 'message'.

Page 42: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 42 RESTful API Documentation FortiADC-E and Equalizer LX

Server Instances

• Functions

showList ($obj_class, $parent_name)

add ($obj_class, $parent_name, $request)

detail ($obj_class, $parent_name, $request)

update ($obj_class, $parent_name, $request)

stats ($obj_class, $parent_name, $request)

delete ($obj_class, $parent_name, $request)

• Function Documentation

• add ($ obj_class, $ parent_name, $ request)

********** Server Instance Add *************

HTTP Method: POST

Request Example: rest/<version>/srvpool/<sp01>/si/<sv01>/

Request & Response format: JSON

Short Description: To associate existing "server" with a particular server pool.

Required Parameter(s) in request.

** "weight":100

Optional Parameter(s) in request.

--> "maxconn":0

--> "probe_port":0

--> "hot_spare":false

--> "persist_override":false

--> "quiesce":false

--> "probe_l4":true

--> "strict_maxconn":false

--> "total_conx":0

Note:

Example- Expecting following JSON in si ADD request

{ "weight" : "100", "probe_l4" : true, "probe_port" : "90" // optional parameter }

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ parent_name, $ request)

********** Server Instance Delete *************

Method: DELETE

Request Example: rest/<version>/srvpool/<sp01>/si/<sv01>/?<force=1>

Page 43: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 43 RESTful API Documentation FortiADC-E and Equalizer LX

Response format: JSON

Short Description: To delete a particular existing server instance <sv01> which would be associated with a particular server pool "sp01".

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ parent_name, $ request)

******** Server Instance Detail **********

HTTP Method: GET

Request Example: rest/<version>/srvpool/<sp01>/si/<sv01>/

Response format: JSON

Short Description: To get the detail of a particular "si" <sv01> instance which would be associated with a particular server pool "sp01".

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showList ($ obj_class, $ parent_name)

********** Server Instance List *************

Method: GET

Request Example: rest/<version>/srvpool/<sp01>/si/

Response format: JSON

Description: To fetch the list of all associated "si" instances of a particular server pool "sp01".

Returns:

JSON response with 'status', 'message' and 'data'(array).

• stats ($ obj_class, $ parent_name, $ request)

********** Server Instance Stats *************

Method: GET

Request Example: rest/<version>/srvpool/<sp01>/si/<sv01>/stats/

Response format: JSON

Short Description: Default, it will return last 10 minutes stats of a particular "si" instance i.e. 'sv01' which would be associated with a particualr server pool "sp01".

Excepting optional parameter(s) in Query String.

--> start (epoch)

--> end (epoch)

--> last (in seconds)

Note:

Example 1 - rest/<version>/srvpool/<sp01>/si/<sv01>/stats/?last=300

Example 2 - rest/<version>/srvpool/<sp01>/si/<sv01> /stats/?start=123456&end=123457

Page 44: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 44 RESTful API Documentation FortiADC-E and Equalizer LX

Returns:

JSON response with 'status', 'message' and 'data' keys.

• update ($ obj_class, $ parent_name, $ request)

********** Server Instance Update *************

HTTP Method: PUT

Request Example: rest/<version>/srvpool/<sp01>/si/<sv01>/

Request & Response format: JSON

Short Description: To update a particular existing instance <sv01> which would be associated with a particular server pool "sp01".

Parameters

== "sequence":""

== "sweight":100

== "status_acv":"Down"

== "status_rsp":0

== "status_description":""

--> "weight":100

--> "maxconn":0

--> "probe_port":0

--> "hot_spare":false

--> "persist_override":false

--> "quiesce":false

--> "probe_l4":true

--> "strict_maxconn":false

Note:

Example- Excepting JSON string in following format to modify a particular parameter of an associated "si" with a particular serevr pool "sp01".

{"hot_spare" : "1", "quiesce" : "1"}

Returns:

JSON response with 'status' and 'message'.

Page 45: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 45 RESTful API Documentation FortiADC-E and Equalizer LX

Server Pools

• Functions

showlist ($obj_class)

add ($obj_class, $request)

detail ($obj_class, $request)

update ($obj_class, $request)

stats ($obj_class, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

********** Server Pool Add *************

HTTP Method: POST

Request Example: rest/<version>/srvpool/<sp01>/

Request & Response format: JSON

Short Description: To add a new "srvpool" object in the configuration.

Required Parameter(s) in request.

** "policy":"round-robin"

Optional Parameter(s) in request.

--> "policy":"round-robin"

--> "resp":5

--> "acv_query":""

--> "acv_response":""

--> "probe_interval":15

--> "probe_maxtries":3

--> "probe_gto":5

--> "probe_cto":1

--> "probe_dto":2

--> "probe_ssl":false

--> "disable":false

--> "custom_hc":0

--> "highest_tls_version":1

--> "custom_delay":33

--> "custom_actconn":33

Note:

Example- Expecting following JSON in srvpool ADD request

Page 46: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 46 RESTful API Documentation FortiADC-E and Equalizer LX

{ "policy" : "custom", "custom_hc":0, "custom_delay":33, "custom_actconn":33 }

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ request)

********** Server Pool Delete *************

Method: DELETE

Request Example: rest/<version>/srvpool/<sp01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a "srvpool" object.

Expecting optional parameter in query string.

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** Server Pool Detail **********

HTTP Method: GET

Request Example: rest/<version>/srvpool/<sp01>/

Response format: JSON

Short Description: To get the detail of a particular "srvpool" <sp01> instance.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showlist ($ obj_class)

********** Server Pool List *************

Method: GET

Request Example: rest/<version>/srvpool/

Response format: JSON

Description: To fetch the list of all available "srvpool" instances from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• stats ($ obj_class, $ request)

********** Server Pool Stats *************

Method: GET

Request Example: rest/<version>/srvpool/<sp01>/stats/

Response format: JSON

Short Description: Default, it will return last 10 minutes stats of a particular srvpool instance i.e. 'sp01'.

Excepting optional parameter(s) in Query String.

--> start (epoch)

Page 47: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 47 RESTful API Documentation FortiADC-E and Equalizer LX

--> end (epoch)

--> last (in seconds)

Note:

Example 1 - rest/<version>/srvpool/<sp01>/stats/?last=300

Example 2 - rest/<version>/srvpool/<sp01>/stats/?start=123456&end=123457

Returns:

JSON response with 'status', 'message' and 'data' keys.

• update ($ obj_class, $ request)

********** Server Pool Update *************

HTTP Method: PUT

Request Example: rest/<version>/srvpool/<sp01>/

Request & Response format: JSON

Short Description: To update a particular existing instance <sp01> of a "srvpool" object.

Parameters

== "sequence":"" (readonly)

== "status_rsp":1 (readonly)

== "status_description":"Server Pool configuration..." (readonly)

--> "policy":"round-robin"

--> "resp":5

--> "acv_query":""

--> "acv_response":""

--> "probe_interval":15

--> "probe_maxtries":3

--> "probe_gto":5

--> "probe_cto":1

--> "probe_dto":2

--> "probe_ssl":false

--> "disable":false

--> "custom_hc":0

--> "highest_tls_version":1

--> "custom_delay":33

--> "custom_actconn":33

Note:

Example- Excepting JSON string in following format to modify a particular parameter of a particular server pool.

{"policy" : "least-cxns"} OR {"resp" : 3 }

Returns:

Page 48: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 48 RESTful API Documentation FortiADC-E and Equalizer LX

JSON response with 'status' and 'message'.

Page 49: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 49 RESTful API Documentation FortiADC-E and Equalizer LX

Subnets

• Functions

detail ($obj_class, $parent_name, $request)

add ($obj_class, $parent_name, $request)

update ($obj_class, $parent_name, $request)

delete ($obj_class, $parent_name, $request)

showList ($obj_class, $parent_name)

showPermittedSubnetList ($obj_class, $parent_name, $request)

addPermittedSubnet ($obj_class, $vlan, $request)

deletePermittedSubnet ($obj_class, $vlan, $request)

• Function Documentation

• add ($ obj_class, $ parent_name, $ request)

********** Subnet Add *************

HTTP Method: POST

Request Example: rest/<version>/vlan/<vla01>/subnet/<sb01>/

Request & Response format: JSON

Short Description: To add a new "subnet" <sb01> to a particular existing VLAN <vl01>.

Required Parameter(s) in request.

** "address":"199.179.10.1\/24",

Optional Parameter(s) in request.

--> "virt_address":"",

--> "heartbeat_interval":2,

--> "strike_count":3,

--> "heartbeat":false,

flags *********

--> "svc_http":false,

--> "svc_https":false,

--> "svc_ssh":false,

--> "svc_snmp":false,

--> "svc_envoy":false,

--> "svc_envoy_agent":false,

--> "svc_fo_http":false,

--> "svc_fo_https":false,

--> "svc_fo_ssh":false,

--> "svc_fo_snmp":false,

Page 50: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 50 RESTful API Documentation FortiADC-E and Equalizer LX

--> "svc_fo_envoy":false,

--> "svc_fo_envoy_agent":false

Note:

Example- Expecting following JSON in subnet ADD request

{ "address" : "x.x.x.x", "svc_http" : 1 // optional parameter }

Returns:

JSON response with 'status' and 'message'.

• addPermittedSubnet ($ obj_class, $ vlan, $ request)

******** Attach Permitted Subnet **********

Method: POST

Request: rest/<version>/vlan/<vl01>/subnet/<sb01>/permit/

Response format: JSON

Short Description: To attach/add a permitted subnet (with a VALN and a subnet) to a particular subnet <sb01> of a particular VLAN <vl01>.

Required Parameter(s):

** vlan name i.e. "vlan" : "vl02" (required)

** subnet name i.e. "subnet" : "sb02" (required)

Note:

Ex- json string would be like - { "vlan" : "vl02", "subnet" : "sb02" }.

Returns:

JSON response with 'status' and 'message'

• delete ($ obj_class, $ parent_name, $ request)

********** Subnet Delete *************

Method: DELETE

Request Example: rest/<version>/vlan/<vl01>/subnet/<sb01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a particular "subnet" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• deletePermittedSubnet ($ obj_class, $ vlan, $ request)

******** Detach Permitted Subnet **********

Method: DELETE

Request: rest/<version>/vlan/<vl01>/subnet/<sb01>/permitted_subnet

Request & Response format: JSON

Description: To delete a attached permitted subnet from a particular subnet i.e. 'sb01' of a particular VLAN i.e. 'vl01'.

Page 51: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 51 RESTful API Documentation FortiADC-E and Equalizer LX

Required Parameter(s): (in JSON)

** vlan name i.e. "vlan" : "vl02" (required)

** subnet name i.e. "subnet" : "sb02" (required)

Note:

Ex- json string would be like - { "vlan" : "vl02", "subnet" : "sb02" }.

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ parent_name, $ request)

******** Subnet Detail **********

HTTP Method: GET

Request Example: rest/<version>/vlan/<vl01>/subnet/<sb01>/

Response format: JSON

Short Description: To get the detail of a particular "subnet" <sb01> of a particular existing VLAN vl01.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showList ($ obj_class, $ parent_name)

********** Subnet List *************

Method: GET

Request Example: rest/<version>/vlan/<vl01>/subnet/

Response format: JSON

Short Description: To fetch the list of associated "subnet" with a particular VLAN <vl01>.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• showPermittedSubnetList ($ obj_class, $ parent_name, $ request)

******** List Permitted Subnet **********

Method: GET

Request: rest/<version>/vlan/<vl01>/subnet/<sb01>/permit/

Response format: JSON

Short Description: To fetch the list of associated vlan-subnets with a particular subnet i.e. 'sb01' of a particular VLAN i.e. 'vl01'.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• update ($ obj_class, $ parent_name, $ request)

********** Subnet Update *************

HTTP Method: PUT

Request Example: rest/<version>/vlan/<vl01>/subnet/<sb01>/

Request & Response format: JSON

Page 52: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 52 RESTful API Documentation FortiADC-E and Equalizer LX

Short Description: To update a particular associated subnet <sb01> with vlan <vl01>.

Parameters

== "sequence":"" (readonly)

--> "address":"199.179.10.1\/24",

--> "virt_address":"",

--> "heartbeat_interval":2,

--> "strike_count":3,

--> "heartbeat":false,

flags *********

--> "svc_http":false,

--> "svc_https":false,

--> "svc_ssh":false,

--> "svc_snmp":false,

--> "svc_envoy":false,

--> "svc_envoy_agent":false,

--> "svc_fo_http":false,

--> "svc_fo_https":false,

--> "svc_fo_ssh":false,

--> "svc_fo_snmp":false,

--> "svc_fo_envoy":false,

--> "svc_fo_envoy_agent":false,

Note:

Example- Excepting JSON string in following format to modify a particular parameter(s) of a particular subnet.

{"address" : "x.x.x.x"}

Returns:

JSON response with 'status' and 'message'.

Page 53: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 53 RESTful API Documentation FortiADC-E and Equalizer LX

Users

• Functions

showList ($obj_class)

add ($obj_class, $request)

detail ($obj_class, $request)

update ($obj_class, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

******** User Add **********

Method: POST

Request Example: rest/<version>/user/<user01>/

Request & Response format: JSON

Short Description: To add a new "user" object in configuration.

Required Parameter:

** "password":"xxxxxx"

Optional Parameter(s):

== "duration":3600

== "locale":"en"

== "admin":false

== "read_global":false

== "write_global":false

Note:

Example- Expecting following JSON in user ADD request

JSON string like - { "password" : "xxxxxx", // required "read_global": true // optional }.

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ request)

********** User Delete *************

Method: DELETE

Request Example: rest/<version>/user/<user01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a "user" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Page 54: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 54 RESTful API Documentation FortiADC-E and Equalizer LX

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** User Detail **********

Method: GET

Request Example: rest/<version>/user/<user01>/

Response format: JSON

Short Description: To get the detail of a particular "user" instance (i.e. user01).

Returns:

JSON response with 'status', 'message' and 'data' keys.

• showList ($ obj_class)

********** User List *************

Method: GET

Request Example: rest/<version>/user/

Response format: JSON

Short Description: To fetch the list of all available "users" from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• update ($ obj_class, $ request)

******** User Update **********

Method: PUT

Request Example: rest/<version>/user/<user01>/

Short Description: To update an existing instance of the "user".

Parameter:

== "password":""

== "duration":3600

== "locale":"en"

== "admin":false

== "read_global":false

== "write_global":false

Note:

Example- Excepting JSON string in following format to modify a particular parameter of a particular user.

{ "admin" : true }

Returns:

JSON response with 'status' and 'message'.

Page 55: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 55 RESTful API Documentation FortiADC-E and Equalizer LX

VLANs

• Functions

showlist ($obj_class)

add ($obj_class, $request)

attachInterface ($obj_class, $parent_name, $request)

detail ($obj_class, $request)

interfaceDetail ($obj_class, $parent_name, $request)

update ($obj_class, $request)

modifyAttachInterface ($obj_class, $parent_name, $request)

detachInterface ($obj_class, $parent_name, $request)

delete ($obj_class, $request)

• Function Documentation

• add ($ obj_class, $ request)

********** VLAN Add *************

HTTP Method: POST

Request Example: rest/<version>/vlan/<vl01>/

Request & Response format: JSON

Short Description: To add a new "vlan" object in the configuration.

Required Parameter(s) in request.

** "vid":1

Optional Parameter(s) in request.

--> "mtu":1500

Note:

Example- Expecting following JSON in vlan ADD request

{ "vid" : "1", "mtu" : "1100" // optional parameter }

Returns:

JSON response with 'status' and 'message'.

• attachInterface ($ obj_class, $ parent_name, $ request)

********** Attach Interface *************

HTTP Method: POST

Request Example: rest/<version>/vlan/<vlan01>/ifi/<if01>/

Response format: JSON

Short Description: To attach an ifi instance to a particular "vlan" object in the configuration.

Required Parameter(s) in request.

** type (untagged/tagged)

Page 56: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 56 RESTful API Documentation FortiADC-E and Equalizer LX

Note:

Example- Expecting following JSON in attaching a particular interface instance ('if01') to a particular vlan ('vlan01').

{ "type" : "tagged" }

Returns:

JSON response with 'status' and 'message'.

• delete ($ obj_class, $ request)

********** VLAN Delete *************

Method: DELETE

Request Example: rest/<version>/vlan/<vl01>/?<force=1>

Response format: JSON

Short Description: To delete an existing instance of a "vlan" object.

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detachInterface ($ obj_class, $ parent_name, $ request)

********** Detach Interface *************

Method: DELETE

Request Example: rest/<version>/vlan/<vlan01>/ifi/<if01>/?<force=1>

Response format: JSON

Short Description: To detach an existing ifi (if01) from a particular "vlan" object (vlan01).

Expecting optional parameter in Query String

--> force flag i.e. "force" = "1" (optional)

Returns:

JSON response with 'status' and 'message'.

• detail ($ obj_class, $ request)

******** VLAN Detail **********

HTTP Method: GET

Request Example: rest/<version>/vlan/<vl01>/

Response format: JSON

Short Description: To get the detail of a particular "vlan" <vl01> instance.

Returns:

JSON response with 'status', 'message' and 'data' keys.

• interfaceDetail ($ obj_class, $ parent_name, $ request)

********** Attached Interface Detail *************

Method: GET

Request Example: rest/<version>/vlan/<vlan01>/ifi/<if01>/

Page 57: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 57 RESTful API Documentation FortiADC-E and Equalizer LX

Response format: JSON

Short Description: To get the detail of an attach interface ifi (if01) with a particular "vlan" object (vlan01).

Returns:

JSON response with 'status', 'message' and 'data' keys.

• modifyAttachInterface ($ obj_class, $ parent_name, $ request)

********** Modify Attached Interface *************

HTTP Method: PUT

Request Example: rest/<version>/vlan/<vlan01>/ifi/<if01>/

Response format: JSON

Short Description: To modify attached ifi instance with a particular "vlan" object.

Required Parameter(s) in request.

** type (untagged/tagged)

Note:

Example- Expecting following JSON for modifying a particular attached interface instance ('if01') with a particular vlan ('vlan01').

{ "type" : "tagged" }

Returns:

JSON response with 'status' and 'message'.

• showlist ($ obj_class)

********** VLAN List *************

Method: GET

Request Example: rest/<version>/vlan/

Response format: JSON

Description: To fetch the list of all available "vlan" instances from the configuration.

Returns:

JSON response with 'status', 'message' and 'data'(array).

• update ($ obj_class, $ request)

********** VLAN Update *************

HTTP Method: PUT

Request Example: rest/<version>/vlan/<vl01>/

Request & Response format: JSON

Short Description: To update a particular existing instance <vl01> of a "vlan" object.

Parameters

== "sequence":"" (readonly)

== "num_sub":1 (readonly)

--> "vid":1

--> "mtu":1500

Page 58: RESTful API Documentation - Fortinet Docs Librarydocs.fortinet.com/uploaded/files/2063/RESTfulAPI_E_Series.pdf · Fortinet Technologies Inc. 5 RESTful API Documentation FortiADC-E

Fortinet Technologies Inc. 58 RESTful API Documentation FortiADC-E and Equalizer LX

Note:

Example- Excepting JSON string in following format to modify a particular parameter of a particular vlan.

{"mtu" : "1500"}

Returns:

JSON response with 'status' and 'message'.