Fortinet white logo
Fortinet white logo

REST API Solution Guide

General API usage

General API usage

View available endpoint resources

JSON query

  • JSON specified via GET

curl -k -v -u "admin:zeyDZXmP6GbKcerqdWWEYNTnH2TaOCz5HTp2dAVS" https://192.168.0.122/api/v1/?format=json

  • JSON specified via Accept Header

curl -k -v -u "admin:zeyDZXmP6GbKcerqdWWEYNTnH2TaOCz5HTp2dAVS" -H 'Accept: application/json' https://192.168.0.122/api/v1/

Response

< HTTP/1.1 200 OK< Date: Mon, 09 Jun 2014 10:51:23 GMT< Server: Apache< Vary: Accept-Language,Cookie< X-Frame-Options: SAMEORIGIN< Content-Language: en< Transfer-Encoding: chunked< Content-Type: application/json<* Connection #0 to host 192.168.0.122 left intact* Closing connection #0

{"auth": {"list_endpoint": "/api/v1/auth/", "schema": "/api/v1/auth/schema/"}, "fgtgroupfilter": {"list_endpoint": "/api/v1/fgtgroupfilter/", "schema": "/api/v1/fgtgroupfilter/schema/"}, "fortitokens": {"list_endpoint": "/api/v1/fortitokens/", "schema": "/api/v1/fortitokens/schema/"}, "localusers": {"list_endpoint": "/api/v1/localusers/", "schema": "/api/v1/localusers/schema/"}, "ssoauth": {"list_endpoint": "/api/v1/ssoauth/", "schema": "/api/v1/ssoauth/schema/"}, "ssogroup": {"list_endpoint": "/api/v1/ssogroup/", "schema": "/api/v1/ssogroup/schema/"}, "usergroups": {"list_endpoint": "/api/v1/usergroups/", "schema": "/api/v1/usergroups/schema/"}}

XML query

  • XML specified via GET

curl -k -v -u "admin:zeyDZXmP6GbKcerqdWWEYNTnH2TaOCz5HTp2dAVS" https://192.168.0.122/api/v1/?format=xml

  • XML specified via Accept Header

curl -k -v -u "admin:zeyDZXmP6GbKcerqdWWEYNTnH2TaOCz5HTp2dAVS" -H 'Accept: application/xml' https://192.168.0.122/api/v1/

Response

< HTTP/1.1 200 OK

< Date: Mon, 09 Jun 2014 11:03:25 GMT

< Server: Apache

< Vary: Accept-Language,Cookie

< X-Frame-Options: SAMEORIGIN

< Content-Language: en

< Transfer-Encoding: chunked

< Content-Type: application/xml; charset=utf-8

<

<?xml version='1.0' encoding='utf-8'?>

* Connection #0 to host 192.168.0.122 left intact

* Closing connection #0

<response><fgtgroupfilter type="hash"><list_endpoint>/api/v1/fgtgroupfilter/</list_endpoint><schema>/api/v1/fgtgroupfilter/schema/</schema></fgtgroupfilter><localusers type="hash"><list_endpoint>/api/v1/localusers/</list_endpoint><schema>/api/v1/localusers/schema/</schema></localusers><usergroups type="hash"><list_endpoint>/api/v1/usergroups/</list_endpoint><schema>/api/v1/usergroups/schema/</schema></usergroups><auth type="hash"><list_endpoint>/api/v1/auth/</list_endpoint><schema>/api/v1/auth/schema/</schema></auth><fortitokens type="hash"><list_endpoint>/api/v1/fortitokens/</list_endpoint><schema>/api/v1/fortitokens/schema/</schema></fortitokens><ssogroup type="hash"><list_endpoint>/api/v1/ssogroup/</list_endpoint><schema>/api/v1/ssogroup/schema/</schema></ssogroup><ssoauth type="hash"><list_endpoint>/api/v1/ssoauth/</list_endpoint><schema>/api/v1/ssoauth/schema/</schema></ssoauth></response>

General API usage

General API usage

View available endpoint resources

JSON query

  • JSON specified via GET

curl -k -v -u "admin:zeyDZXmP6GbKcerqdWWEYNTnH2TaOCz5HTp2dAVS" https://192.168.0.122/api/v1/?format=json

  • JSON specified via Accept Header

curl -k -v -u "admin:zeyDZXmP6GbKcerqdWWEYNTnH2TaOCz5HTp2dAVS" -H 'Accept: application/json' https://192.168.0.122/api/v1/

Response

< HTTP/1.1 200 OK< Date: Mon, 09 Jun 2014 10:51:23 GMT< Server: Apache< Vary: Accept-Language,Cookie< X-Frame-Options: SAMEORIGIN< Content-Language: en< Transfer-Encoding: chunked< Content-Type: application/json<* Connection #0 to host 192.168.0.122 left intact* Closing connection #0

{"auth": {"list_endpoint": "/api/v1/auth/", "schema": "/api/v1/auth/schema/"}, "fgtgroupfilter": {"list_endpoint": "/api/v1/fgtgroupfilter/", "schema": "/api/v1/fgtgroupfilter/schema/"}, "fortitokens": {"list_endpoint": "/api/v1/fortitokens/", "schema": "/api/v1/fortitokens/schema/"}, "localusers": {"list_endpoint": "/api/v1/localusers/", "schema": "/api/v1/localusers/schema/"}, "ssoauth": {"list_endpoint": "/api/v1/ssoauth/", "schema": "/api/v1/ssoauth/schema/"}, "ssogroup": {"list_endpoint": "/api/v1/ssogroup/", "schema": "/api/v1/ssogroup/schema/"}, "usergroups": {"list_endpoint": "/api/v1/usergroups/", "schema": "/api/v1/usergroups/schema/"}}

XML query

  • XML specified via GET

curl -k -v -u "admin:zeyDZXmP6GbKcerqdWWEYNTnH2TaOCz5HTp2dAVS" https://192.168.0.122/api/v1/?format=xml

  • XML specified via Accept Header

curl -k -v -u "admin:zeyDZXmP6GbKcerqdWWEYNTnH2TaOCz5HTp2dAVS" -H 'Accept: application/xml' https://192.168.0.122/api/v1/

Response

< HTTP/1.1 200 OK

< Date: Mon, 09 Jun 2014 11:03:25 GMT

< Server: Apache

< Vary: Accept-Language,Cookie

< X-Frame-Options: SAMEORIGIN

< Content-Language: en

< Transfer-Encoding: chunked

< Content-Type: application/xml; charset=utf-8

<

<?xml version='1.0' encoding='utf-8'?>

* Connection #0 to host 192.168.0.122 left intact

* Closing connection #0

<response><fgtgroupfilter type="hash"><list_endpoint>/api/v1/fgtgroupfilter/</list_endpoint><schema>/api/v1/fgtgroupfilter/schema/</schema></fgtgroupfilter><localusers type="hash"><list_endpoint>/api/v1/localusers/</list_endpoint><schema>/api/v1/localusers/schema/</schema></localusers><usergroups type="hash"><list_endpoint>/api/v1/usergroups/</list_endpoint><schema>/api/v1/usergroups/schema/</schema></usergroups><auth type="hash"><list_endpoint>/api/v1/auth/</list_endpoint><schema>/api/v1/auth/schema/</schema></auth><fortitokens type="hash"><list_endpoint>/api/v1/fortitokens/</list_endpoint><schema>/api/v1/fortitokens/schema/</schema></fortitokens><ssogroup type="hash"><list_endpoint>/api/v1/ssogroup/</list_endpoint><schema>/api/v1/ssogroup/schema/</schema></ssogroup><ssoauth type="hash"><list_endpoint>/api/v1/ssoauth/</list_endpoint><schema>/api/v1/ssoauth/schema/</schema></ssoauth></response>