0% found this document useful (0 votes)
406 views

FortiAuthenticator REST API

The document describes how to make API requests to retrieve and modify data from various resources on a server. It provides examples of GET requests to list and retrieve details of specific resources in both JSON and XML formats. It also shows a POST request example to create a new resource. The API uses common RESTful conventions for URLs, parameters, response codes and contains resources for user groups, authentication and other network management objects.

Uploaded by

aykargil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
406 views

FortiAuthenticator REST API

The document describes how to make API requests to retrieve and modify data from various resources on a server. It provides examples of GET requests to list and retrieve details of specific resources in both JSON and XML formats. It also shows a POST request example to create a new resource. The API uses common RESTful conventions for URLs, parameters, response codes and contains resources for user groups, authentication and other network management objects.

Uploaded by

aykargil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

server_name

api_version
resource
id

?format=[format_type]
?limit=[integer]

?offset=[integer]

?order_by=[field]

name__exact=John Doe

?name__in=John&name__in=Bill)
GET /[resource]/
(list)
GET /[resource]/[id]/
(detail) id
POST /[resource]/

PUT /[resource]/
(list)

PUT /[resource]/[id]/
(detail) id

DELETE /[resource]/
(list)
DELETE /[resource]/[id]/
(detail) id
PATCH /[resource]/[id]/
(detail) id

/localusers/

/usergroups/

/auth/

/ssogroup/

/fgtgroupfilter
/

/ssoauth/
-k
-v
-u USER[:PASSWORD]

-d @<filename>

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk"
https://192.168.0.123/api/v1/?format=json

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -H 'Accept:


application/json' https://192.168.0.123/api/v1/
< HTTP/1.1 200 OK
< Date: Fri, 20 Sep 2013 08:15:04 GMT
< Server: Apache
< Vary: Accept-Language,Cookie
< Content-Language: en
< Transfer-Encoding: chunked
< Content-Type: application/json
<
* Connection #0 to host 192.168.0.123 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/"}, "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/"}}

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk"
https://192.168.0.123/api/v1/?format=xml

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -H 'Accept:


application/xml' https://192.168.0.123/api/v1/

< HTTP/1.1 200 OK


< Date: Fri, 20 Sep 2013 10:45:29 GMT
< Server: Apache
< Vary: Accept-Language,Cookie
< 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.123 left intact
* Closing connection #0
<response><fgtgroupfilter
type="hash"><list_endpoint>/api/v1/fgtgroupfilter/</list_endpoint><schema>/api/v1/fg
tgroupfilter/schema/</schema></fgtgroupfilter><localusers
type="hash"><list_endpoint>/api/v1/localusers/</list_endpoint><schema>/api/v1/localu
sers/schema/</schema></localusers><usergroups
type="hash"><list_endpoint>/api/v1/usergroups/</list_endpoint><schema>/api/v1/usergr
oups/schema/</schema></usergroups><auth
type="hash"><list_endpoint>/api/v1/auth/</list_endpoint><schema>/api/v1/auth/schema/
</schema></auth><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/s
chema/</schema></ssoauth></response>
https://[server_name]/api/[api_version]/ssogroup/

curl -k -v -u "admin: ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk "


https://192.168.0.123/api/v1/ssogroup/?format=xml

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -H 'Accept:


application/xml' https://192.168.0.123/api/v1/ssogroup/

< HTTP/1.1 200 OK


< Date: Fri, 20 Sep 2013 11:32:10 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Cache-Control: no-cache
< Set-Cookie: sessionid=jnri1mrsddyaz02yly69erxhnozo7o7b; httponly; Path=/
< Transfer-Encoding: chunked
< Content-Type: application/xml; charset=utf-8
<
<?xml version='1.0' encoding='utf-8'?>
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0
<response><objects type="list"><object><id
type="integer">1</id><name>CN=FW_Admin,DC=corp,DC=example,DC=com</name><resource_uri
>/api/v1/ssogroup/1/</resource_uri></object><object><id
type="integer">3</id><name>CN=SSL_Users,DC=corp,DC=example,DC=com</name><resource_ur
i>/api/v1/ssogroup/3/</resource_uri></object><object><id
type="integer">2</id><name>CN=Sales,DC=corp,DC=example,DC=com</name><resource_uri>/a
pi/v1/ssogroup/2/</resource_uri></object><object><id
type="integer">4</id><name>Group1</name><resource_uri>/api/v1/ssogroup/4/</resource_
uri></object></objects><meta type="hash"><next type="null"/><total_count
type="integer">4</total_count><previous type="null"/><limit
type="integer">20</limit><offset type="integer">0</offset></meta></response>
curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk "
https://192.168.0.123/api/v1/ssogroup/?format=json

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -H 'Accept:


application/json' https://192.168.0.123/api/v1/ssogroup/

< HTTP/1.1 200 OK


< Date: Fri, 20 Sep 2013 11:29:13 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Cache-Control: no-cache
< Set-Cookie: sessionid=rgw8xmng2vwwz4plfjno507gm2dsr4ix; httponly; Path=/
< Transfer-Encoding: chunked
< Content-Type: application/json
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0
{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count":
4}, "objects": [{"id": 1, "name": "CN=FW_Admin,DC=corp,DC=example,DC=com",
"resource_uri": "/api/v1/ssogroup/1/"}, {"id": 3, "name":
"CN=SSL_Users,DC=corp,DC=example,DC=com", "resource_uri": "/api/v1/ssogroup/3/"},
{"id": 2, "name": "CN=Sales,DC=corp,DC=example,DC=com", "resource_uri":
"/api/v1/ssogroup/2/"}, {"id": 4, "name": "Group1", "resource_uri":
"/api/v1/ssogroup/4/"}]}

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -X POST -d


'{"name":"Group2"}' -H 'Content-Type: application/json'
https://192.168.0.123/api/v1/ssogroup/

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -X POST -d


'<object><name>Group2</name></object>' -H 'Content-Type: application/xml'
https://192.168.0.123/api/v1/ssogroup/

< HTTP/1.1 201 CREATED


< Date: Fri, 14 Sep 2013 18:54:32 GMT
< Server: Apache
< Vary: Cookie
< Set-Cookie: sessionid=f32e6bc346722af773cf32408d8657dd; httponly; Path=/
< Location: https://192.168.0.123/api/v1/ssogroup/3/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
https://[server_name]/api/[api_version]/fgtgroupfilter/

curl -k -v -u "admin:9c2mY^07cO#EcvR*1VWkAX533xtZcYQ5Fck#KHch"
https://192.168.0.123/api/v1/fgtgroupfilter/?format=xml

curl -k -v -u "admin:9c2mY^07cO#EcvR*1VWkAX533xtZcYQ5Fck#KHch" -H 'Accept:


application/xml' https://192.168.0.123/api/v1/fgtgroupfilter/

< HTTP/1.1 200 OK


< Date: Fri, 14 Sep 2012 13:35:09 GMT
< Server: Apache
< Set-Cookie: sessionid=ac1f87e351f301a3a1d5f68936d55260; httponly; Path=/
< Transfer-Encoding: chunked
< Content-Type: application/xml; charset=utf-8
<
<response><objects type="list"/><meta type="hash"><next type="null"/><total_count
type="integer">0</total_count><previous type="null"/><limit
type="integer">20</limit><offset type="integer">0</offset></meta></response>
https://[server_name]/api/[api_version]/localusers/


curl -k -v -u "admin:9c2mY^07cO#EcvR*1VWkAX533xtZcYQ5Fck#KHch"
https://192.168.0.123/api/v1/localusers/?format=xml

curl -k -v -u "admin:9c2mY^07cO#EcvR*1VWkAX533xtZcYQ5Fck#KHch" -H 'Accept:


application/xml' https://192.168.0.123/api/v1/ localusers/

< HTTP/1.1 200 OK


< Date: Fri, 20 Sep 2013 13:09:58 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Cache-Control: no-cache
< Set-Cookie: sessionid=b6l7spednoksl67zfjtwd2o82cpaq945; httponly; Path=/
< Transfer-Encoding: chunked
< Content-Type: application/json
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0
{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count":
1}, "objects": [{"address": "", "city": "", "country": "", "custom1": "", "custom2":
"", "custom3": "", "email": "", "first_name": "", "id": 4, "last_name": "",
"mobile_number": "", "phone_number": "", "resource_uri": "/api/v1/localusers/4/",
"state": "", "user_groups": [], "username": "dbane"}]}[
curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -X POST -d
'{"username":"testuser","password":"testpassword"}' -H 'Content-Type:
application/json' https://192.168.0.123/api/v1/localusers/

< HTTP/1.1 201 CREATED


< Date: Fri, 20 Sep 2013 13:16:10 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Set-Cookie: sessionid=eqe113282xvi1bh453odiv193e96ylfv; httponly; Path=/
< Location: https://192.168.0.123/api/v1/localusers/7/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk"
https://192.168.0.123/api/v1/localusers/?format=json
< HTTP/1.1 200 OK
< Date: Fri, 20 Sep 2013 13:16:45 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Cache-Control: no-cache
< Set-Cookie: sessionid=0e1qmbbi9hqks06be5qb5yy52ijkk8cw; httponly; Path=/
< Transfer-Encoding: chunked
< Content-Type: application/json
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0
{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count":
2}, "objects": [{"address": "", "city": "", "country": "", "custom1": "", "custom2":
"", "custom3": "", "email": "", "first_name": "", "id": 4, "last_name": "",
"mobile_number": "", "phone_number": "", "resource_uri": "/api/v1/localusers/4/",
"state": "", "user_groups": [], "username": "dbane"}, {"address": "", "city": "",
"country": "", "custom1": "", "custom2": "", "custom3": "", "email": "",
"first_name": "", "id": 7, "last_name": "", "mobile_number": "", "phone_number": "",
"resource_uri": "/api/v1/localusers/7/", "state": "", "user_groups": [], "username":
"testuser"}]}
https://[server_name]/api/[api_version]/usergroups/

curl -k -v -u "admin:9c2mY^07cO#EcvR*1VWkAX533xtZcYQ5Fck#KHch"
https://192.168.0.123/api/v1/usergroups/?format=xml

curl -k -v -u "admin:9c2mY^07cO#EcvR*1VWkAX533xtZcYQ5Fck#KHch" -H 'Accept:


application/xml' https://192.168.0.123/api/v1/usergroups/

< HTTP/1.1 200 OK


< Date: Fri, 20 Sep 2013 13:11:12 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Cache-Control: no-cache
< Set-Cookie: sessionid=as82kjjh2ayy58cop55ntr2nn9b7cksw; httponly; Path=/
< Transfer-Encoding: chunked
< Content-Type: application/json
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0
{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count":
1}, "objects": [{"id": 1, "name": "Test", "resource_uri": "/api/v1/usergroups/1/",
"users": []}]}

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -X POST -d


'{"name":"Group999"}' -H 'Content-Type: application/json'
https://192.168.0.123/api/v1/usergroups/
< HTTP/1.1 201 CREATED
< Date: Fri, 20 Sep 2013 13:12:47 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Set-Cookie: sessionid=2d26geo7iunoywhpf7nv9gskmxciv2fu; httponly; Path=/
< Location: https://192.168.0.123/api/v1/usergroups/2/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0

< HTTP/1.1 200 OK


< Date: Fri, 20 Sep 2013 13:13:43 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Cache-Control: no-cache
< Set-Cookie: sessionid=y2fg0xqk30mjhk5rkhdv2idrz14silno; httponly; Path=/
< Transfer-Encoding: chunked
< Content-Type: application/json
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0
{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count":
2}, "objects": [{"id": 2, "name": "Group999", "resource_uri":
"/api/v1/usergroups/2/", "users": []}, {"id": 1, "name": "Test", "resource_uri":
"/api/v1/usergroups/1/", "users": []}]}[Carl@CentOS ~]
https://[server_name]/api/[api_version]/ssoauth/


curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -d
'{"event":"1","username":"cwindsor","user_ip":"10.1.73.175"}' -H "Content-Type:
application/json" https://192.168.0.123/api/v1/ssoauth/

< HTTP/1.1 200 OK


< Date: Fri, 20 Sep 2013 08:27:27 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Set-Cookie: sessionid=6q6m6ne4v7p76qclajitlf2q7202f7g6; httponly; Path=/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -d
'{"event":"1","username":"atano","user_ip":"10.1.73.175"}' -H "Content-Type:
application/json" https://192.168.0.123/api/v1/ssoauth/
< HTTP/1.1 200 OK
< Date: Fri, 20 Sep 2013 08:32:21 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Set-Cookie: sessionid=g062qqmsj6nr0hk5khd2q7202e4v36m; httponly; Path=/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
<
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0

curl -k -v -u "admin:ant@jFlxC-HKsau7X^2qqg-vLo-B0bqW3GFHfyzk" -d
'{"event":"0","username":"atano","user_ip":"10.1.73.175"}' -H "Content-Type:
application/json" https://192.168.0.123/api/v1/ssoauth/

< HTTP/1.1 200 OK


< Date: Fri, 20 Sep 2013 08:34:09 GMT
< Server: Apache
< Vary: Accept,Accept-Language,Cookie
< Content-Language: en
< Set-Cookie: sessionid=2q de4v36msj6g05khm6nr02q72q02hk; httponly; Path=/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
* Connection #0 to host 192.168.0.123 left intact
* Closing connection #0
https://[server_name]/api/[api_version]/auth/

{"username": "<username>", "token_code": "<token_code>", "password":


"<password>"}
curl -k -v -u "admin:9c2mY^07cO#EcvR*1VWkAX533xtZcYQ5Fck#KHch" -d
'{"username":"testuser","password":"testpass"}' -H "Content-Type: application/json"
https://192.168.0.123/api/v1/auth/

< HTTP/1.1 200 OK


< Date: Fri, 14 Sep 2012 15:38:57 GMT
< Server: Apache
< Vary: Cookie
< Set-Cookie: sessionid=6b17c5bbb86419a94f6979a05bd84139; httponly; Path=/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8
curl -k -v -u "admin:9c2mY^07cO#EcvR*1VWkAXT -d '{"username":"testuser","token_code":"893753"}' -H
"Content-Type: application/json" https://192.168.0.123/api/v1/auth/

< HTTP/1.1 200 OK


< Date: Fri, 14 Sep 2012 15:47:22 GMT
< Server: Apache
< Vary: Cookie
< Set-Cookie: sessionid=f15beeab159a4bf2d0402a05db40d6ae; httponly; Path=/
< Content-Length: 0
< Content-Type: text/html; charset=utf-8

HTTP/1.1 401 UNAUTHORIZED


Date: Thu, 13 Sep 2012 13:57:24 GMT
Server: Apache
Vary: Cookie
Set-Cookie: sessionid=abe8bac6fc50caf5eadf1e57f0c60e3e; httponly; Path=/
Content-Length: 26
Content-Type: text/html; charset=utf-8

HTTP/1.1 401 UNAUTHORIZED


Date: Thu, 13 Sep 2012 13:55:18 GMT
Server: Apache
Vary: Cookie
Set-Cookie: sessionid=e95090804ee0e3b8903618138b38a5c8; httponly; Path=/
Content-Length: 26
Content-Type: text/html; charset=utf-8

HTTP/1.1 404 NOT FOUND


Date: Thu, 13 Sep 2012 13:58:54 GMT
Server: Apache
Vary: Cookie
Set-Cookie: sessionid=3b353061d9141567c02bb0d057b18284; httponly; Path=/
Content-Length: 19
Content-Type: text/html; charset=utf-8

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy