0% found this document useful (0 votes)
15 views90 pages

FortiPortal 7.0.0 REST API Guide

Uploaded by

mahdi1674
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views90 pages

FortiPortal 7.0.0 REST API Guide

Uploaded by

mahdi1674
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 90

REST API Guide

FortiPortal 7.0.0
FORTINET DOCUMENT LIBRARY
https://docs.fortinet.com

FORTINET VIDEO GUIDE


https://video.fortinet.com

FORTINET BLOG
https://blog.fortinet.com

CUSTOMER SERVICE & SUPPORT


https://support.fortinet.com

FORTINET TRAINING & CERTIFICATION PROGRAM


https://www.fortinet.com/training-certification

NSE INSTITUTE
https://training.fortinet.com

FORTIGUARD CENTER
https://www.fortiguard.com

END USER LICENSE AGREEMENT


https://www.fortinet.com/doc/legal/EULA.pdf

FEEDBACK
Email: techdoc@fortinet.com

July 4, 2022
FortiPortal 7.0.0 REST API Guide
37-700-735203-20220704
TABLE OF CONTENTS

Change Log 7
Introduction 8
REST API background 8
Available API methods 8
FortiPortal API methods 10
Admin log in and log out 10
Customers and customer users 10
Customer Sites Provisioning 11
FortiAnalyzer 12
FortiManager 12
System Provisioning 13
User Provisioning 14
Using the API 15
Accessing the API 15
Headers 15
URL parameters 15
JSON payload parameters 15
Success response structure 16
Failure response structure 16
Authentication 16
Authentication example 16
Python examples 17
Basic setup (use this code for each example) 17
Retrieve a collection 17
Retrieve an object 17
API HTTP response codes 17
API reference 19
Logging in and out 19
Admin log In 19
Admin log out 19
Customers 20
Get all customers 20
Get a specific customer 20
Create a new customer 21
Edit an existing customer 22
Delete a customer record 22
Customer ADOMs 23
Display ADOMs assigned to a customers 23
Create or update a list of ADOMs for a customer 23
FortiAnalyzer reports for a customer 24
Assign FortiAnalyzer reports to a customer 24
Unassign FortiAnalyzer reports from a customer 25
Get unassigned FortiAnalyzer reports that the specified customer can assign 25

FortiPortal 7.0.0 REST API Guide 3


Fortinet Inc.
Get FortiAnalyzer reports that are assigned to the specified customer 26
Customer comment-based and name-based filters 27
Display comment-based and name-based filters under a customer 27
Update comment-based and name-based filters under a customer 28
Customer domain 28
Display domains resource under a customer 28
Add or edit a domain under a customer 29
Customer policy and object permission 29
Display policy tab permission resource under a customer 29
Create or update policy and object permission resource under a customer 30
Customer policy tab permission 31
Display policy tab permission under a customer 31
Create or update policy tab permission under a customer 32
Customer tab permission 33
Display tab permission under a customer 33
Create or update tabs permission under a customer 34
Customer widget permissions 34
Display widget permission to a customer 34
Create or update widget permissions of a customer 35
FortiAnalyzer 35
Get all FortiAnalyzer units 35
Get detailed information for a specific FortiAnalyzer 36
Add a new FortiAnalyzer to FortiPortal 37
Edit the information for an existing FortiAnalyzer 37
Delete a FortiAnalyzer record 38
Update the list of FortiAnalyzer reports 39
Get FortiAnalyzer report templates for a specific FortiAnalyzer 39
FortiManager 40
Get FortiManager information 40
Get information for a specified FortiManager 40
FortiManager polling 41
Create a FortiManager record 41
Edit a FortiManager record 42
Delete a FortiManager record 42
Customer policy installation details 43
Return a list of policy installations executed for the customer 43
Get details of a specific policy installation 44
Customer sites provisioning 45
Get all customer sites 45
Get a specific customer site 45
Create a new customer site 46
Edit a customer site record 47
Delete a customer site 47
Customer user 48
Get all customer users 48
Get a specific customer user 48
Create a new customer user 49
Edit an existing customer user 50

FortiPortal 7.0.0 REST API Guide 4


Fortinet Inc.
Delete a customer user 50
Customer widgets 51
Get all customer widgets 51
Customer WiFi networks 51
Get all customer WiFi networks 52
Get a specific customer WiFi network 52
Create a new customer WiFi network 53
Edit a customer WiFi network 54
Delete a customer WiFi network 54
System provisioning 55
Get all devices 55
Get all ADOMs 56
Outputs 56
Get all roles 56
Get information for a specified role 57
Get all FAPs 57
Get audit logs 58
Get alerts 59
Get cloud usage 60
Get cloud usage for a specific customer 61
Get countries 61
Get details for a specific country 62
Get policy installations by all customers in a specified time range 62
Users 63
Get all users 63
Create a service provider user 64
Utility widget 65
List all widgets resource by type 65
License 65
Upload a license file 65
Retrieve license information 66
API examples 67
Log in 67
Response 67
Create a new site 67
Response 68
Comment-based and name-based filters 68
Get a list of filters assigned to a specific customer 68
Update the filters assigned to a specific customer 69
Customers domain 69
GET example 69
POST example (update domains) 70
Validation 71
Customers tab permission 71
GET example 71
POST example (update tab permissions) 71
Customers policy tab permission 72

FortiPortal 7.0.0 REST API Guide 5


Fortinet Inc.
GET example 72
POST example (update policy tab permissions) 73
Customers policy and objects permission 74
GET example 74
POST example (update tab permissions) 74
Headers 74
Customers widget permission 75
GET example 75
POST example (update domains) 76
Widget 77
GET example 77
Customers ADOM list 78
GET example 78
POST example (update domains) 78
Customers policy installation 79
GET all example 79
GET installation details by ID 80
Display all customers 81
FortiAnalyzer reports 82
Get unassigned FortiAnalyzer reports that the specified customer can assign 82
Get FortiAnalyzer reports that are assigned to the specified customer 83
Assign FortiAnalyzer reports to a customer 83
Unassign FortiAnalyzer reports from a customer 84
Get all FortiAnalyzer units 84
Get detailed information for a specific FortiAnalyzer 85
Add a new FortiAnalyzer to FortiPortal 85
Edit the information for an existing FortiAnalyzer 86
Remove a FortiAnalyzer from FortiPortal 87
Update the list of FortiAnalyzer reports 87
List FortiAnalyzer report templates for a specific FortiAnalyzer 87
Support license upload 88
License information 89
Get example 89

FortiPortal 7.0.0 REST API Guide 6


Fortinet Inc.
Change Log

Date Change Description

2022-07-04 Initial release.

FortiPortal 7.0.0 REST API Guide 7


Fortinet Inc.
Introduction

This document provides information about the REST API supported by FortiPortal 7.0.0.
API responses include data in JSON format. Each API response also includes an HTTP response code, to indicate the
success or failure of the operation.

REST API background

A RESTful API uses standard HTTP methods (Get, Post, Delete) to provide interactions between a client and a server.
The API is stateless - each request is independent.
The following operations are supported by a RESTful API:
1. Fetch data by sending a GET request
2. Add data by sending a POST request
3. Update data by sending a POST request
4. Delete data by sending a DELETE request
GET and DELETE are idempotent. The operation will produce the same result no matter how many times it is repeated.

Available API methods

Use the API to access and modify the following objects:


1. Customer Provisioning
a. Customers:
i. List customers and devices associated with the customer
ii. Add a new customer
iii. Edit an existing customer
iv. Delete a customer
v. List and update the ADOMs for a specific customer
vi. List, add, and edit domains for a customer
vii. List all installations related to a customer or details for a specific installation
viii. List, add, or update policy, object, and tab permissions for a customer
ix. List and update comment-based and name-based filters for a customer
x. List, add, and update widgets for a specific customer
xi. List unassigned FortiAnalyzer reports that a specified customer can assign
xii. List FortiAnalyzer reports that are assigned to the specified customer
xiii. Assign FortiAnalyzer reports to a specific customer
xiv. Unassign FortiAnalyzer reports from a specific customer

FortiPortal 7.0.0 REST API Guide 8


Fortinet Inc.
Introduction

b. Sites
i. List sites
ii. Add new site
iii. Edit an existing site
iv. Delete the site
c. Wifi Networks
i. Add, edit, and delete wireless networks
2. User Provisioning
a. Users
i. List users
ii. Add new user (customer or server provider user)
iii. Edit an existing user
iv. Delete the user
v. List roles assigned to the user
3. System Provisioning
a. FortiManager
i. List, add, edit, and delete the FortiManager
ii. FortiManager polling
b. FortiAnalyzer
i. List all connected FortiAnalyzer units
ii. Add, edit, or delete the FortiAnalyzer unit
iii. Update the FortiAnalyzer report list
iv. List FortiAnalyzer report templates
c. List all devices and the associated customer
d. List the available devices that can be assigned to customer sites
e. List all FAPs and the associated customer
f. List all roles and the permissions for each role
g. Get cloud usage for customers
h. Display audit and alert logs
i. List policy installations for all customers in a specified time range

FortiPortal 7.0.0 REST API Guide 9


Fortinet Inc.
FortiPortal API methods

The FortiPortal provides the following API methods. You need to log in to the API using a valid Admin User account (not
a customer user account) before you can use the other API methods.

Admin log in and log out

Method Path Parameters Description

POST /login Log in to the FortiPortal with user name and password

POST /logout Log out of FortiPortal

Customers and customer users

Method Path Parameters Description

GET /customers Retrieve all customers record

POST /customers Create a new customer record

GET /customers/{cid} Retrieve the information for a customer record identified


by the customer ID

POST /customers/{cid} Edit an existing customer record

POST /customers/delete/{cid} Delete a customer record

GET /customers/{cid}/adoms Get a list of ADOMs assigned to a specific customer

POST /customers/{cid}/adoms Update the list of ADOMs assigned to a specific


customer

POST /customers/{cid}/assignfazreports Assign the specified FortiAnalyzer reports to a specific


customer

POST /customers/{cid}/unassignfazreports Unassign the specified FortiAnalyzer reports from a


specific customer

GET /customers/{cid}/availablefazreports Get a list of unassigned FortiAnalyzer reports that the


specified customer can assign

GET /customers/{cid}/assignedfazreports Get a list of FortiAnalyzer reports that are assigned to


the specified customer

FortiPortal 7.0.0 REST API Guide 10


Fortinet Inc.
FortiPortal API methods

Method Path Parameters Description

GET /customers/{cid}/commentnamebasedfilters Get a list of comment-based and name-based filters that


are assigned to a specific customer

POST /customers/{cid}/commentnamebasedfilters Update comment-based and name-based filters that are


assigned to a specific customer

GET /customers/{cid}/domains Get domain names assigned to customer

POST /customers/{cid}/domains Add or update domain assigned to customer

GET /customers/{cid}/installs?startdate=’yyyy- Get all installations related to customer with a given


MM-dd HH:mm:ss’&enddate= ’yyyy-MM-dd identifier and within the specified date range.
HH:mm:ss The following are the valid date formats: yyyy-MM-dd
HH:mm:ss, yyyy-MM-dd HH:mm

GET /customers/{cid}/installs/{installid} Get installation details for given installation id


(installation logs, tasked)

GET /customers/{cid}/policyobjects Get policy and object permissions assigned to customer

POST /customers/{cid}/policyobjects Add or update policy and object permissions assigned to


customer

GET /customers/{cid}/policytabs Get policy tab permissions assigned to customer

POST /customers/{cid}/policytabs Add or update policy tab permissions assigned to


customer

GET /customers/{cid}/tabs Get tab permissions assigned to customer

POST /customers/{cid}/tabs Add or update tab permissions assigned to customer

GET /customers/{cid}/users List all users for a particular customer

POST /customers/{cid}/users Create a new user under a particular customer

GET /customers/{cid}/users/{uid} List the user information for a particular user ID

POST /customers/{cid}/users/delete/{uid} Delete the user from the customer

POST /customers/{cid}/users/{uid} Edit the existing user information

GET /customers/{cid}/widgets Get widgets assigned to customer

POST /customers/{cid}/widgets Add or update widgets assigned to customer

Customer Sites Provisioning

Method Path Parameters Description

GET /customers/{cid}/sites List all sites for a particular customer

GET /customers/{cid}/sites/{sid} List the site information for a particular site ID

FortiPortal 7.0.0 REST API Guide 11


Fortinet Inc.
FortiPortal API methods

Method Path Parameters Description

POST /customers/{cid}/sites Create a site under a particular customer

POST /customers/{cid}/sites/{sid} Edit the existing site information

POST /customers/{cid}/sites/delete/{sid} Delete the site from the customer record

GET /customers/{cid}/sites/{sid}/wifinetworks Retrieve all WiFi networks under a customer site.

GET /customers/{cid}/sites/{sid}/wifinetworks/{id} List the WiFi network information for a particular WiFi
network ID

POST /customers/{cid}/sites/{sid}/wifinetworks Create a new WiFi network record

POST /customers/{cid}/sites/{sid}/wifinetworks/{id} Edit an existing WiFi network record

POST /customers/{cid}/sites/ Delete an existing WiFi network record


{sid}/wifinetworks/delete/{id}

FortiAnalyzer

Method Path Parameters Description

GET /fortianalyzers Retrieve all FortiAnalyzer units

GET /fortianalyzers/{faid} Retrieve FortiAnalyzer information by FortiAnalyzer ID

POST /fortianalyzers Add a new FortiAnalyzer to FortiPortal

POST /fortianalyzers/{faid} Edit the information for an existing FortiAnalyzer

DELETE /fortianalyzers/{faid} Remove a FortiAnalyzer from FortiPortal

GET /fortianalyzers/{faid}/pollnow Update the list of FortiAnalyzer reports

GET /fortianalyzers/{faid}/reporttemplates List FortiAnalyzer report templates for a specific


FortiAnalyzer

FortiManager

Method Path Parameters Description

GET /fortimanagers Retrieve all FortiManager units

GET /fortimanagers/{fmid} Retrieve FortiManager by FortiManager ID

GET /fortimanagers/{fmid}/pollnow The poll updates the list of FortiManager devices in the
FortiPortal.

POST /fortimanagers Create a new FortiManager record

FortiPortal 7.0.0 REST API Guide 12


Fortinet Inc.
FortiPortal API methods

Method Path Parameters Description

POST /fortimanagers/{fmid} Edit an existing FortiManager record

POST /fortimanagers/delete/{fmid} Delete an existing FortiManager record

System Provisioning

Method Path Parameters Description

GET /devices or /devices?status= List all devices

GET /devices?status=available List the devices that can be assigned to


customer sites

GET /devices?haRole=master and /devices?haRole=slave List all primary devices or all secondary
devices, depending on the value specified.

GET /adom List all ADOMs

GET /roles List all roles

GET /roles/{roleid} Retrieve role and its permissions by ID

GET /faps Retrieve all faps information

GET /auditlogs?Start_date= "MM/dd/yyyy" &End_date= List audit logs for the specified time range or
"MM/dd/yyyy" or /auditlogs?frequencyValue=<time> the specified number or days or hours

GET /auditlogs?frequencyValue=<time>&pageStart=<row_ List the specified number of records for the


number>&pageLength=<number_of_records> specified number of days or hours

GET /alerts List alerts for time range specified

GET /widgets/?type=<type> Type can be either “SP” or Get Widgets resource by type. To get list of
“CUST” Widget that can be assigned to customer
use CUST

GET /cloudusage Retrieve cloud usage for all customers

GET /cloudusage/{cid} Retrieve cloud usage for a single customer

GET /countries Retrieve a list of all countries in the


FortiPortal database

GET /countries/{countryId} Get details for a specified country

GET /installs/?startdate=’yyyy-MM-dd HH:mm:ss’&enddate= List policy installations for all customers in a


’yyyy- MM-dd HH:mm:ss specified time range

FortiPortal 7.0.0 REST API Guide 13


Fortinet Inc.
FortiPortal API methods

User Provisioning

Method Path Parameters Description

GET /users Retrieve all local users in the FortiPortal

POST /users Create a new Service provider user

FortiPortal 7.0.0 REST API Guide 14


Fortinet Inc.
Using the API

This chapter provides details on accessing and authenticating the FortiPortal API.
See Accessing the API on page 15 and Authentication on page 16.

Accessing the API

Create web requests using HTTP Get or Post message with the following fields:
https://<ipaddress>:<port>/fpc/api/<path parameters>

Headers

Set the following HTTP header fields:


l Content-type: application/json
l fpc-sid: <session ID token as returned by the login command>
The fpc-sid header is mandatory in all API calls except the login API.

URL parameters

FortiPortal API follows the standard REST format for the request URLs.
In a request to get all entries of a collection, or to add a new entry to a collection, the URL includes the collection name.
In a request to get, update or delete a specific member of a collection, the URL includes the collection name and the
index of the specific entry. For a nested collection (such as customer sites), the URL may contain more than one index
(one for customer ID, one for site ID).
The URL parameters are always mandatory. If you do not provide a valid ID for each index in the request URL, the
request will result in a failure response.

JSON payload parameters

In the methods to add a new entry or update an existing entry in a collection, the payload contains the input fields for the
entry. The payload information is sent as text in JSON format.
Some input fields are required, and some are optional. You must provide values for the required fields. The
API Reference chapter lists the required and optional fields for each API method.

FortiPortal 7.0.0 REST API Guide 15


Fortinet Inc.
Using the API

Success response structure

API returns the following values in a successful response message:


l HTTP status 200
l A JSON string, whose content depends on the API method.

Failure response structure

API returns the following values in a failure response message:


l HTTP status 500
l A JSON structure with the error details

Authentication

To initiate requests to the FortiPortal REST API, you need to log in to the FortiPortal. Send a POST request using the
following format:
https://<ipaddress>:<port>/fpc/api/login

Parameters (JSON structure in the payload):


l user: a valid admin user name
l password: password for the above name
If the login is successful, the response will contain a session ID that must be included in all subsequent API requests.

Authentication example

The following example shows the contents of the request message and the response:
HTTP post message:

url: https://10.0.0.1/fpc/api/login
Content-type: application/json
Payload:
{
“user” : “spuser”,
“password” : “test123”
}

Response message:
Status : 200 OK
Payload:
{
“sid” : “8478V00xYhva_ndcihDi203ru3c1auaUb1icew0W_TT”
}

FortiPortal 7.0.0 REST API Guide 16


Fortinet Inc.
Using the API

Python examples

The following snippets of Python code provide examples of how to use the FortiPortal API.

Basic setup (use this code for each example)

The following example shows how to log in to the API, and retrieve the session ID from the response message:
url_login="https://10.16.0.42/fpc/api/login"
client = requests.session()

#Login request
payload = {'user' : 'myuser', 'password' : 'mypass'}
r = client.post(url_login, json=payload, verify=False )

#Retrieve session id. Add to HTTP header for future messages


parsed_json = json.loads(r.text)
sid = parsed_json['fpc-sid']
headers = {'fpc-sid' : sid }

Retrieve a collection

The following example shows how to gather all customer users for customer index 1:
url_cust_req="https://10.16.0.42/fpc/api/customers/1/users"
r = client.get(url_cust_req, headers=headers, verify=False)

Retrieve an object

The following example shows how to obtain device index 3:


url_cust_req="https://10.160.14.103/fpc/api/devices/3"
r = client.get(url_cust_req, headers=headers, verify=False)

API HTTP response codes

The API returns an HTTP status code to indicate the disposition of the request:

200 Status ok Request successful

400 Bad request Bad request

403 Forbidden Request is missing the CSRF token or administrator is missing access profile
permissions

404 Not Found Unable to find the specified resource

FortiPortal 7.0.0 REST API Guide 17


Fortinet Inc.
Using the API

405 Method Not Allowed Specified HTTP method is not allowed for this resource

413 Request Entity Too


Large

424 Failed Dependency

500 Internal Server Error

FortiPortal 7.0.0 REST API Guide 18


Fortinet Inc.
API reference

This chapter provides details about each of the API methods. You need to log in to the FortiPortal using admin user
credentials before using the other API methods.

Logging in and out

Admin log In

Method URL Description Arguments Outputs

POST /login Logs user in to the FortiPortal, user, password Sid


using user and password as
credentials

Arguments (JSON payload)

Parameter Type Required Description

user string Y Administrator user name

password string Y Administrator password

Outputs

Parameter Type Description

fpc-sid string Unique session identifier. Include this value in the fpc-sid header for
each subsequent request

Admin log out

Method URL Description Arguments Outputs

POST /logout Logs user out of FortiPortal

Arguments

None.

FortiPortal 7.0.0 REST API Guide 19


Fortinet Inc.
API reference

Outputs

None.

Customers

FortiPortal contains a record for each customer.

Get all customers

Method URL Description Arguments Outputs

GET /customers Retrieve all customers records none JSON array

Arguments

None

Outputs

Parameter Type Description

JSON array Array of customer records. One entry per customer, each record
contains a unique customer ID (cid). See the customer record table.

Get a specific customer

Method URL Description Arguments Outputs

GET /customers/{cid} Retrieve information for a cid customer record


particular customer

Arguments

Parameter Type Description

cid int Customer ID

Outputs (customer record)

The customer record contains the following fields:

FortiPortal 7.0.0 REST API Guide 20


Fortinet Inc.
API reference

Parameter Type Description

customerId int Customer ID

customerName string Name of the customer

contactFName string First name of the contact person

contactLName string Last name of the contact person

contactEmail string Email address of the contact person

totalStorage int Total customer storage

fpcStorage int Storage assigned to portal

collectorStorage int Storage assigned to collector

collectorStoragePercentage string Collector total percentage (the rest is for portal usage)

fpcStorageUsage string Current fpc storage usage

collectorStorageUsage string Current collector usage

deviceName string Comma-separated list of the name of devices assigned to


the customer. You can use this list to calculate the total
number of devices for this customer.

Create a new customer

Method URL Description Arguments Outputs

POST /customers/ Create a new customer See the next table. cid

Arguments (customer fields—JSON payload)

Parameter Type Required Description

customerName string Y Name of the customer

address1 string Address line 1

address2 string Address line 2

analyticsEnabled string Y Set to Y or N.

NOTE: If you set analyticsEnabled to N,


make sure that the totalStorage is set to 50 or
more.

city string Name of the city

state string Name of the state

zip string Postal code

FortiPortal 7.0.0 REST API Guide 21


Fortinet Inc.
API reference

Parameter Type Required Description

phone string Phone number for the customer

fax string Fax number for the customer

contactFName string Y First name of the contact person

contactLName string Y Last name of the contact person

contactEmail string Y Email address of the contact person

totalStorage int Y Total customer storage.

NOTE: When analyticsEnabled is set to N,


the storage units are MB. When
analyticsEnabledis set to Y, the storage units
are GB.

collectorStoragePercentage int Collector total percentage (the rest is for portal


usage)

Outputs

Parameter Type Description

cid int Unique customer ID of the newly created customer

Edit an existing customer

Method URL Description Arguments Outputs

POST /customers/{cid} Update the customer record for See the next table. none
an existing customer

Arguments

Parameter Type Description

cid int Unique customer ID of the newly created customer

customer fields JSON payload See Arguments (customer fields—JSON payload).

Delete a customer record

Method URL Description Arguments Outputs

POST /customers/delete/ Delete a customer from none none


{cid} FortiPortal

FortiPortal 7.0.0 REST API Guide 22


Fortinet Inc.
API reference

Arguments

Parameter Type Description

cid int Customer ID

No outputs.

Customer ADOMs

Display ADOMs assigned to a customers

Method URL Description Arguments Outputs

GET /customers/ Display ADOMs assigned to a cid See the Outputs


{cid}/adoms customers table.

Arguments

Parameter Type Description

cid int Customer ID.

Outputs

HTTP Response: 200 OK


Response Data:

Parameter Type Description

Id int ADOMs list resource ID

customerId int Customer ID

adoms JSON array of strings List of ADOM names

Create or update a list of ADOMs for a customer

Method URL Description Arguments Outputs

POST /customers/ Create or update list of ADOMs Id, customerId, 200 OK


{cid}/adoms for a customer adoms

FortiPortal 7.0.0 REST API Guide 23


Fortinet Inc.
API reference

Arguments

Parameter Type Description

Id int ADOMs list resource ID

customerId int Customer ID

adoms JSON array of strings List of ADOM names

FortiAnalyzer reports for a customer

Assign FortiAnalyzer reports to a customer

Method URL Description Arguments Outputs

POST /customers/ Assign one or more available See the following HTTP Response
{cid}/assignfazreports FortiAnalyzer reports to a tables. 200 OK
specific customer

Arguments

Parameter Type Description

cid int Required. Customer ID

Arguments (JSON payload)

Parameter Type Description

Reportids List (integer) Required. Identifiers for one or more FortiAnalyzer reports to be
assigned to the customer

Outputs

HTTP Response 200 OK

FortiPortal 7.0.0 REST API Guide 24


Fortinet Inc.
API reference

Unassign FortiAnalyzer reports from a customer

Method URL Description Arguments Outputs

POST /customers/ Unassign one or more See the following HTTP Response
{cid}/unassignfazreports available FortiAnalyzer tables. 200 OK
reports from a specific
customer

Arguments

Parameter Type Description

cid int Required. Customer ID

Arguments (JSON payload)

Parameter Type Description

Reportids List (integer) Required. Identifiers for one or more FortiAnalyzer reports to be
unassigned from the customer

Outputs

HTTP Response 200 OK

Get unassigned FortiAnalyzer reports that the specified customer can assign

Method URL Description Arguments Outputs

GET /customers/ Retrieve a list of unassigned cid See the Outputs


{cid}/availablefazreports FortiAnalyzer reports that table.
the specified customer can
assign

Arguments

Parameter Type Description

cid int Required. Customer ID

Outputs (FortiAnalyzer report record)

The FortiAnalyzer report record contains the following fields:

FortiPortal 7.0.0 REST API Guide 25


Fortinet Inc.
API reference

Parameter Type Description

ipAddress string IP address of the FortiAnalyzer

reportName string Name of the FortiAnalyzer report

startTime string The start time of the period covered by the report

endTime string The end time of the period covered by the report

fazName string Name of the FortiAnalyzer

adom string Name of ADOM

reportId int Report identifier

customerId int Customer identifier

fazId int FortiAnalyzer identifier

customerName string Customer name

devices int Number of FortiAnalyzer units

Get FortiAnalyzer reports that are assigned to the specified customer

Method URL Description Arguments Outputs

GET /customers/ Retrieve a list of cid See the Outputs


{cid}/assignedfazreports FortiAnalyzer reports that table.
are assigned to the specified
customer

Arguments

Parameter Type Description

cid int Required. Customer ID

Outputs (FortiAnalyzer report record)

The FortiAnalyzer report record contains the following fields:

Parameter Type Description

ipAddress string IP address of the FortiAnalyzer

reportName string Name of the FortiAnalyzer report

startTime string The start time of the period covered by the report

endTime string The end time of the period covered by the report

FortiPortal 7.0.0 REST API Guide 26


Fortinet Inc.
API reference

Parameter Type Description

fazName string Name of the FortiAnalyzer

adom string Name of ADOM

reportId int Report identifier

customerId int Customer identifier

fazId int FortiAnalyzer identifier

customerName string Customer name

devices int Number of FortiAnalyzer units

Customer comment-based and name-based filters

Display comment-based and name-based filters under a customer

Method URL Description Arguments Outputs

GET /customers/ Display comment-based cid See the Outputs


{cid}/commentnamebasedfilters and name-based filters table.
under a customer

Arguments

Parameter Type Description

cid int Customer ID

Outputs

Parameter Type Description

customerId int Customer ID

commentBasedFilter JSON array List of comment-based filters

nameBasedFilter JSON array List of name-based filters

FortiPortal 7.0.0 REST API Guide 27


Fortinet Inc.
API reference

Update comment-based and name-based filters under a customer

Method URL Description Arguments Outputs

POST /customers/ Update comment-based See the next table. 200 OK


{cid}/commentnamebasedfilters and name-based filters An error is
under a customer returned in
the response
if any of the
following
characters
have been
used: ()\"<>#

Arguments (JSON payload)

Parameter Type Description

customerId int Customer ID

commentBasedFilter JSON array List of comment-based filters

nameBasedFilter JSON array List of name-based filters

Customer domain

Display domains resource under a customer

Method URL Description Arguments Outputs

GET /customers/ List all sites for a particular cid See the Outputs
{cid}/domains customer table.

Arguments

Parameter Type Description

cid int Customer ID

FortiPortal 7.0.0 REST API Guide 28


Fortinet Inc.
API reference

Outputs

Parameter Type Description

domainId int Domain ID

customerId int Customer ID

domainNames JSON array of string Domain names of customer

type string Type of domains CUST (customer)

Add or edit a domain under a customer

Method URL Description Arguments Outputs

GET /customers/ Create or update a domain See the next table. 200 OK
{cid}/domains under a customer

Arguments

Parameter Type Description

domainId int Domain ID

customerId int Customer ID

domainNames JSON array of string Domain names of customer

type string Type of domains CUST (customer)

Customer policy and object permission

Display policy tab permission resource under a customer

Method URL Description Arguments Outputs

GET /customers/ Display policy tab permission cid See the Outputs
{cid}/policyobjects resource under a customer table.

Arguments

Parameter Type Description

cid int Customer ID

FortiPortal 7.0.0 REST API Guide 29


Fortinet Inc.
API reference

Outputs

Parameter Type Description

Id int Tab permission ID

customerId int Customer ID

webfilter boolean Web Filter object permission

applicationControl boolean Application control object permission

dlp boolean DLP object permission

firewallAddress boolean Firewall Address object permission

policyObjectWrite boolean Policy-Object write permission

ipsSensor boolean IPS Sensor object permission

antivirus boolean Anti-Virus object permission

user boolean User object permission

userGroup boolean User Group object permission

vip boolean Virtual object write permission

localCategory boolean Local category object permission

ratingOverrides boolean Rating overrides object permission

service boolean Service object permission

schedule boolean Schedule object permission

anitSpam boolean Anti spam object permission

dnsfilter boolean DNS filter object permission

zoneInterface boolean Zone/Interface object permission

dlpfilterRegex boolean DLP filter regex permission

webfilterRegex boolean Web filter regex permission

Create or update policy and object permission resource under a customer

Method URL Description Arguments Outputs

POST /customers/ Create or update policy and See the next table. 200 OK
{cid}/policyobjects object permission resource
under a customer

FortiPortal 7.0.0 REST API Guide 30


Fortinet Inc.
API reference

Arguments (JSON payload)

Parameter Type Description

webfilter boolean Web Filter object permission

applicationControl boolean Application control object permission

dlp boolean DLP object permission

firewallAddress boolean Firewall address object permission

policyObjectWrite boolean Policy-Object w rite permission

ipsSensor boolean IPS Sensor object permission

antivirus boolean Antivirus object permission

user boolean User object permission

userGroup boolean User Group object permission

vip boolean Virtual Object Write permission

localCategory boolean Local Category object permission

ratingOverrides boolean Rating Overridesobject permission

service boolean Service object permission

schedule boolean Schedule object permission

anitSpam boolean Anti spam object permission

dnsfilter boolean DNS filter object permission

zoneInterface boolean Zone/Interface object permission

dlpfilterRegex boolean DLP filter regex permission

webfilterRegex boolean Web filter regex permission

Customer policy tab permission

Display policy tab permission under a customer

Method URL Description Arguments Outputs

GET /customers/ Display policy tab permission cid See the Outputs
{cid}/policytabs resource under a customer table.

FortiPortal 7.0.0 REST API Guide 31


Fortinet Inc.
API reference

Arguments

Parameter Type Description

cid int Customer ID

Outputs

Parameter Type Description

Id int Tab permission ID

customerId int Customer ID

centralNat boolean CentralNat tab permission

interfacePolicy6 boolean Interface policy tab permission

dosPolicy6 boolean DosPolicy6 tab permission

policy64 boolean DosPolicy64 tab permission

interfacePolicy boolean InterfacePolicy tab permission

policy6 boolean Policy6 tab permission

dosPolicy boolean DosPolicy tab permission

policy46 boolean Policy46 resource tab permission

Create or update policy tab permission under a customer

Method URL Description Arguments Outputs

GET /customers/ Create or update policy tab See the next table. 200 OK
{cid}/policytabs permission resource under a
customer

Arguments (JSON payload)

Parameter Type Description

Id int Tab permission Id

customerId int Customer Id

centralNat boolean CentralNat tab permission

interfacePolicy6 boolean Interface policy tab permission

dosPolicy6 boolean DosPolicy6 tab permission

FortiPortal 7.0.0 REST API Guide 32


Fortinet Inc.
API reference

Parameter Type Description

policy64 boolean DosPolicy64 tab permission

interfacePolicy boolean InterfacePolicy tab permission

policy6 boolean Policy6 tab permission

dosPolicy boolean DosPolicy tab permission

policy46 boolean Policy46 resource tab permission

Customer tab permission

Display tab permission under a customer

Method URL Description Arguments Outputs

GET /customers/ Display tab permission under a cid See the Outputs
{cid}/tabs customer table.

Arguments

Parameter Type Description

cid int Customer ID

Outputs

Parameter Type Description

Id int Tab permission ID

customerId int Customer ID

dashboard boolean Dashboard tab permission

view boolean View tab permission

wifi boolean Wireless network tab permission

reports boolean Reports tab permission

policy boolean Policy tab permission

objects boolean Objects AP tab permission

additionalResources boolean Additional resources tab permission

deviceManager boolean Device Manager tab permission.

FortiPortal 7.0.0 REST API Guide 33


Fortinet Inc.
API reference

Parameter Type Description

auditLogs boolean Audit Log tab permission.

sdwan boolean SD-WAN tab permission

deviceHealth boolean Device Health tab permission

Create or update tabs permission under a customer

Method URL Description Arguments Outputs

POST /customers/ Create or update tabs See the next table. 200 OK
{cid}/tabs permission under a customer

Arguments (JSON payload)

Parameter Type Description

dashboard boolean Dashboard tab permission

view boolean View tab permission

wifi boolean Wireless network tab permission

reports boolean Reports tab permission

policy boolean Policy tab permission

objects boolean Objects AP tab permission

additionalResources boolean Additional resources tab permission

deviceManager boolean Device Manager tab permission.

auditLogs boolean Audit Log tab permission.

sdwan boolean SD-WAN tab permission

deviceHealth boolean Device Health tab permission

Customer widget permissions

Display widget permission to a customer

Method URL Description Arguments Outputs

GET /customers/ Display widget permission to a cid See the Outputs


{cid}/widgets customer table.

FortiPortal 7.0.0 REST API Guide 34


Fortinet Inc.
API reference

Arguments

Parameter Type Description

cid int Customer ID.

Outputs

Parameter Type Description

widgetPermissionId int Widget Permission ID

customerId int Customer ID

widgets JSON array List of widgets object

Create or update widget permissions of a customer

Method URL Description Arguments Outputs

POST /customers/ Create or update widget See the next table. 200 OK
{cid}/widgets permissions of a customer

Arguments (JSON payload)

Parameter Type Description

widgetPermissionId int Widget Permission Id

customerId int Customer Id

widgets JSON array List of widgets object

FortiAnalyzer

FortiPortal contains a record for each FortiAnalyzer that is registered in this FortiPortal.

Get all FortiAnalyzer units

Method URL Description Arguments Outputs

GET /fortianalyzers Retrieve information about all None JSON array


FortiAnalyzer units

FortiPortal 7.0.0 REST API Guide 35


Fortinet Inc.
API reference

Arguments

None

Outputs (FortiAnalyzer record)

HTTP Response 200 OK


Each FortiAnalyzer record contains the following fields:

Parameter Type Description

adminUserName string FortiAnalyzer user name

fazVersion string FortiAnalyzer firmware version

name string FortiAnalyzer name

ipAddress string IP address of the FortiAnalyzer

id int FortiAnalyzer identifier

status string Status of the FortiAnalyzer

Get detailed information for a specific FortiAnalyzer

Method URL Description Arguments Outputs

GET /fortianalyzers/{faid} Retrieve information for the faid JSON array


specified FortiAnalyzer

Arguments

Parameter Type Description

faid int Required. FortiAnalyzer identifier

Outputs (FortiAnalyzer record)

HTTP Response 200 OK


The FortiAnalyzer record contains the following fields:

Parameter Type Description

id int FortiAnalyzer identifier

name string FortiAnalyzer name

ipAddress string IP address of the FortiAnalyzer

FortiPortal 7.0.0 REST API Guide 36


Fortinet Inc.
API reference

Parameter Type Description

adminUserName string FortiAnalyzer user name

status string Status of the FortiAnalyzer

lastRunTime int Most recent FortiAnalyzer polling time

xmlPort int XML port number of the FortiAnalyzer

jsonPort int JSON port number of the FortiAnalyzer

fazVersion string FortiAnalyzer firmware version

Add a new FortiAnalyzer to FortiPortal

Method URL Description Arguments Outputs

POST /fortianalyzers Create a new FortiAnalyzer See the next table. faid
record

Arguments (JSON payload)

Parameter Type Required Description

name String Yes FortiAnalyzer name

ipAddress String Yes IP address of the FortiAnalyzer

adminUserName String Yes FortiAnalyzer user name

adminPassword String Yes FortiAnalyzer password

jsonPort Integer Yes FortiAnalyzer JSON port

frequencyValue String No FortiAnalyzer polling frequency; always set to poll daily

xmlPort Integer No FortiAnalyzer XML port. The default value is 8080.

Outputs

Parameter Type Description

faid int FortiAnalyzer identifier

Edit the information for an existing FortiAnalyzer

Method URL Description Arguments Outputs

POST /fortianalyzers/{faid} Edit a FortiAnalyzer record FortiAnalyzer HTTP Response 200


identifier OK

FortiPortal 7.0.0 REST API Guide 37


Fortinet Inc.
API reference

Arguments

Parameter Type Description

faid int Required. FortiAnalyzer identifier

JSON payload See the next table.

Arguments (JSON payload)

Parameter Type Required Description

name String Yes FortiAnalyzer name

ipAddress String Yes IP address of the FortiAnalyzer

adminUserName String Yes FortiAnalyzer user name

adminPassword String Yes FortiAnalyzer password

jsonPort Integer Yes FortiAnalyzer JSON port

frequencyValue String No FortiAnalyzer polling frequency; always set to poll daily

xmlPort Integer No FortiAnalyzer XML port. The default value is 8080.

Outputs

HTTP Response 200 OK

Delete a FortiAnalyzer record

Method URL Description Arguments Outputs

DELETE /fortianalyzers/{faid} Delete the FortiAnalyzer record. faid HTTP Response


200 OK

Arguments

Parameter Type Description

faid int Required. FortiAnalyzer identifier

Outputs

HTTP Response 200 OK

FortiPortal 7.0.0 REST API Guide 38


Fortinet Inc.
API reference

Update the list of FortiAnalyzer reports

Method URL Description Arguments Outputs

GET /fortianalyzers/ Update the list of FortiAnalyzer faid HTTP Response 200
{faid}/pollnow reports. OK

Arguments

Parameter Type Description

faid int Required. FortiAnalyzer identifier

Get FortiAnalyzer report templates for a specific FortiAnalyzer

Method URL Description Arguments Outputs

GET /fortianalyzers/ Retrieve a list of FortiAnalyzer faid JSON array


{faid}/reporttemplates report templates for a specific
FortiAnalyzer

Arguments

Parameter Type Description

faid int Required. FortiAnalyzer identifier

Outputs (FortiAnalyzer report template record)

HTTP Response 200 OK


The FortiAnalyzer report template record contains the following fields:

Parameter Type Description

fazId int FortiAnalyzer identifier

reportName string Name of the FortiAnalyzer report template

reportId int FortiAnalyzer report template identifier

fazName string FortiAnalyzer name

customerId int Customer identifier

adom string Name of ADOM

customerName string Customer name

FortiPortal 7.0.0 REST API Guide 39


Fortinet Inc.
API reference

FortiManager

FortiPortal contains a record for each FortiManager that is registered in this FortiPortal.

Get FortiManager information

Method URL Description Arguments Outputs

GET /fortimanagers Retrieve FortiManager None JSON array


information

Arguments

None

Outputs

Parameter Type Description

JSON array Array of FortiManager records, one entry per FortiManager. Each
record contains a unique FortiManager ID. See the FortiManager
Record table.

Get information for a specified FortiManager

Method URL Description Arguments Outputs

GET /fortimanagers/{fmid} Retrieve information for the fmid See the Outputs
specified FortiManager table.

Arguments

Parameter Type Description

fmid int FortiManager identifier

Outputs (FortiManager record)

Parameter Type Description

fortiManagerId int FortiManager identifier

FortiPortal 7.0.0 REST API Guide 40


Fortinet Inc.
API reference

Parameter Type Description

fortiManagerName String FortiManager name

haMode String HA mode (standalone, primary, or secondary)

Status String Status of the FortiManager

connectionStatus String Connection status - Up or Down.

ipAddress String IP address of the FortiManager

portNumber int Port number of the FortiManager

FortiManager polling

Method URL Description Arguments Outputs

GET /fortimanagers/ The poll updates the list of fmid 200 OK


{fmid}/pollnow FortiManager devices in the
FortiPortal. 400 Bad Request

Arguments

Parameter Type Description

fmid int FortiManager identifier

Create a FortiManager record

Method URL Description Arguments Outputs

POST /fortimanagers Create a new FortiManager userType fmid


record

Arguments (FortiManager fields—JSON payload)

Parameter Type Required Description

fortiManagerName String Yes FortiManager name

ipAddress String Yes IP address of the FortiManager

adminUserName String Yes Admin user name

adminPassword String Yes Password for the admin user.

frequencyValue String Yes Polling frequency (No polling, daily, weekly or monthly).

portNumber int Yes Port number of the FortiManager

FortiPortal 7.0.0 REST API Guide 41


Fortinet Inc.
API reference

Outputs

Parameter Type Description

fmid int FortiManager identifier

Edit a FortiManager record

Method URL Description Arguments Outputs

POST /fortimanagers/{fmid} Edit a FortiManager record FortiManager


identifier

Arguments

Parameter Type Description

fmid int FortiManager identifier

JSON payload See the FortiManager fields table.

Outputs

None.

Delete a FortiManager record

Method URL Description Arguments Outputs

POST /fortimanagers/delete/ Delete the FortiManager fmid none


{fmid} record.

Arguments

Parameter Type Description

fmid int FortiManager ID.

Outputs

None.

FortiPortal 7.0.0 REST API Guide 42


Fortinet Inc.
API reference

Customer policy installation details

Return a list of policy installations executed for the customer

Valid date formats are ’yyyy-MM-dd HH:mm’ or ’yyyy-MM-dd HH:mm:ss’; other formats result in an invalid date error
response.

Method URL Description Arguments Outputs

GET /fpc/api/customers/ Return a list of policy cid, Startdate, See the Outputs
{cid}/installs/?startdate=’yyyy- installations executed for Enddate table.
MM-dd HH:mm:ss’&enddate= the customer
’yyyy-MM-dd HH:mm:ss'

Argument—Path

Parameter Type Description

cid (required) int Customer ID.

Arguments—Query

Parameter Type Description

Startdate (required) string Startdate: start of date range. Date format : ‘yyyy-MM-dd HH:mm:ss’

Enddate (required) string Enddate: end of date range. Date format : ‘yyyy-MM-dd HH:mm:ss’

Outputs

HTTP Response: 200 OK


Response Data: Array of policy installations details

Parameter Type Description

Id int Installation ID

taskId int Task ID for installation as in FortiManager

customerId int Customer ID

customerName string Customer name

userId int User Id who initiated policy installation

username string User name

deviceName string Device name (FortiGate name)

FortiPortal 7.0.0 REST API Guide 43


Fortinet Inc.
API reference

Parameter Type Description

packageName string Name of package in FortiManager that is being installed in device

vdomName string Vdom Name in FortiManager

adomName string Adom Name in FortiManager

taskDetails string Message about installation task

fortiManagerId int FortiManager ID

createdOn long Created on

Get details of a specific policy installation

Installid is the Id of Installation resources

Method URL Description Arguments Outputs

GET /fpc/api/customers/ Get details of policy installation See the next table. See the Output
{cid}/installs/ for given install id table.
{installid}

Arguments (Path parameter)

Parameter Type Description

InstallId (required) int Installation identifier

customerId int Customer identifier


(required)

Output

HTTP Response 200 OK

Parameter Type Description

InstallId (required) int Installation ID

taskId int Taskid for installation as in FortiManager

customerId int Customer ID

customerName string Customer name

installationLog string Installation log details from FortiManager

errorCoce string Error code from FortiManager

errorMsg string Error message from FortiManager

FortiPortal 7.0.0 REST API Guide 44


Fortinet Inc.
API reference

Customer sites provisioning

FortiPortal contains a record for each site that is defined for a customer.

Get all customer sites

Method URL Description Arguments Outputs

GET /customers/ List all sites for a particular cid JSON array
{cid}/sites customer

Arguments

Parameter Type Description

cid int Customer ID.

Outputs

Parameter Type Description

JSON array Array of customer site records. One entry per customer site, each
record contains a unique site ID. See the Customer Site Record table.

Get a specific customer site

Method URL Description Arguments Outputs

GET /customers/ List the user information for a cid, sid customer site record
{cid}/sites/{sid} particular site id

Arguments

Parameter Type Description

cid int Customer ID.

sid int Site ID.

Outputs (customer site record)

The customer site record contains the following fields:

FortiPortal 7.0.0 REST API Guide 45


Fortinet Inc.
API reference

Parameter Type Description

networkId int Site ID.

networkName String Name of the site.

contactName String Name of the contact for the site.

contactEmail String Email address of the contact.

status String Site status (active or inactive)

fpcDeviceModels JSONArray Devices assigned to the site

Create a new customer site

The network name must be 45 or fewer characters. The system does not support more than 45 characters for a network
name.

Method URL Description Arguments Outputs

POST /customers/ Create a new site for a particular See the next table. cid
{cid}/sites customer

Arguments

Parameter Type Description

cid int Customer ID.

customer site fields JSON payload See the next table.

Arguments (customer site fields)

Parameter Type Required Description

networkName String Y Name of the network. NOTE: The network name must be
45 or fewer characters. The system does not support
more than 45 characters for a network name.

contactName String Y Name of the contact for the site.

contactEmail String Y Email address of the contact.

status String Site status (active or inactive)

fpcDeviceModels JSON array Devices assigned to the site

FortiPortal 7.0.0 REST API Guide 46


Fortinet Inc.
API reference

Outputs

Parameter Type Description

sid int ID of the newly created site.

Edit a customer site record

The name of a customer site must be 45 or fewer characters. The system does not support more than 45 characters for a
customer site name.

Method URL Description Arguments Outputs

POST /customers/ Edit an existing site. See the next table. none
{cid}/sites/{sid}

Arguments

Parameter Type Description

cid int customer ID

sid int site ID

customer site fields JSON payload See Arguments (customer WiFi network fields).

Delete a customer site

Method URL Description Arguments Outputs

POST /customers/ Delete the customer site. none none


{cid}/sites/delete/
{sid}

Arguments

Parameter Type Description

cid int Customer ID.

sid int Site ID.

No outputs.

FortiPortal 7.0.0 REST API Guide 47


Fortinet Inc.
API reference

Customer user

FortiPortal contains a record for each user that is defined for a customer.

Get all customer users

Method URL Description Arguments Outputs

GET /customers/ List all users for a particular cid JSON array
{cid}/users customer

Arguments

Parameter Type Description

cid int Customer ID.

Outputs

Parameter Type Description

JSON array Array of customer user records. One entry per customer user, each
record contains a unique user ID. See the Customer User Record
table.

See the Customer User Record table for the contents of a customer user record.

Get a specific customer user

Method URL Description Arguments Outputs

GET /customers/ List the user information for a cid, uid customer user
{cid}/users/{uid} particular user id record

Arguments

Parameter Type Description

cid int Customer ID.

uid int User ID.

FortiPortal 7.0.0 REST API Guide 48


Fortinet Inc.
API reference

Outputs (customer user record)

The customer user record contains the following fields:

Parameter Type Description

usererId int User ID.

userName String Name of the user.

firstName String First name of the user.

lastName String Last name of the user.

email String Email address of the user.

userType String Type of user (customer or SP)

status String User status (active or inactive)

roles JSON array Roles assigned to the user

Create a new customer user

Method URL Description Arguments Outputs

POST /customers/ Create a new user under a See the next table. cid
{cid}/users particular customer

Arguments

Parameter Type Description

cid int Customer ID.

customer user fields JSON payload See the next table.

Arguments (customer user fields)

Parameter Type Required Description

userName String Y Name of the user.

firstName String Y First name of the user.

lastName String Y Last name of the user.

password String Y Password for the user.

address1 String Address line 1

address2 String Address line 2

FortiPortal 7.0.0 REST API Guide 49


Fortinet Inc.
API reference

Parameter Type Required Description

city String Name of the city

state String Name of the state

zip String Postal code

country Country

phone String Phone number for the user

fax String Fax number for the user

email String Y Email address of the contact person.

pwdEnable boolean Password policy

roles JSON array Array of user roles.

Outputs

Parameter Type Description

uid int Unique ID of the newly created user.

Edit an existing customer user

Method URL Description Arguments Outputs

POST /customers/ Edit the existing user information See the next table. none
{cid}/users/{uid}

Arguments

Parameter Type Description

cid int customer ID

uid int user ID

customer user fields JSON payload See the Arguments (customer user fields) table.

Delete a customer user

Method URL Description Arguments Outputs

POST /customers/ Delete the user from the none none


{cid}/users/delete/ customer
{uid}

FortiPortal 7.0.0 REST API Guide 50


Fortinet Inc.
API reference

Arguments

Parameter Type Description

cid int Customer ID.

uid int User ID.

No outputs.

Customer widgets

FortiPortal contains a record for each widget that a customer is using in the customerʼs portal dashboard.

Get all customer widgets

Method URL Description Arguments Outputs

GET /customers/ List all widgets for a particular cid JSON array
{cid}/widgets customer

Arguments

Parameter Type Description

cid int Customer ID.

Outputs

Parameter Type Description

uid String Widget unique string

widgetId int Widget ID.

name String Name of the widget.

Customer WiFi networks

FortiPortal contains a record for each WiFi network that is defined for the specified customer site.

FortiPortal 7.0.0 REST API Guide 51


Fortinet Inc.
API reference

Get all customer WiFi networks

Method URL Description Arguments Outputs

GET /customers/ List all WiFi networks for a cid, sid JSON array
{cid}/sites/ particular customer
{sid}/wifinetworks

Arguments

Parameter Type Description

cid int Customer ID.

sid int Customer Site ID.

Outputs

Parameter Type Description

JSON array Array of customer WiFi network records. One entry per WiFi network,
each record contains a unique network ID. See the Customer Wifi
Network Record table.

Get a specific customer WiFi network

Method URL Description Arguments Outputs

GET /customers/ List the WiFi network information cid, sid, customer WiFi
{cid}/sites/ for a particular network id wifiNetworkId network record
{sid}/wifinetwork/
{wifiNetworkId}

Arguments

Parameter Type Description

cid int Customer ID.

sid int Site ID.

wifiNetworkId int WiFi network ID

Outputs (customer WiFi network record)

The customer WiFi network record contains the following fields:

FortiPortal 7.0.0 REST API Guide 52


Fortinet Inc.
API reference

Parameter Type Description

wifiNetworkId int WiFi network ID.

wifiNetworkName String Name of the site.

contactName String Name of the contact for the site.

contactEmail String Email address of the contact.

status String Site status (active or inactive).

fpcwFapModels JSON array Fortinet APs assigned to the network.

Create a new customer WiFi network

Method URL Description Arguments Outputs

POST /customers/ Create a new network for a See the next table. wifiNetworkId
{cid}/sites/ particular customer
{sid}/wifinetworks

Arguments

Parameter Type Description

cid int Customer ID.

sid int Site ID

customer WiFi JSON payload See the next table.


network fields

Arguments (customer WiFi network fields)

Parameter Type Required Description

wifiNetworkName String Y Name of the network.

contactName String Y Name of the contact for the network.

contactEmail String Y Email address of the contact.

status String Network status (active or inactive).

fpcwFapModels JSON array Fortinet APs assigned to the network.

FortiPortal 7.0.0 REST API Guide 53


Fortinet Inc.
API reference

Outputs

Parameter Type Description

wifiNetworkId int ID of the newly created network.

Edit a customer WiFi network

Method URL Description Arguments Outputs

POST /customers/ Edit an existing WiFi network. See the next table. none
{cid}/sites/
{sid}/wifinetwork/
{wifiNetworkId}

Arguments

Parameter Type Description

cid int customer ID

sid int site ID

wifiNetworkId int WiFi network ID

network fields JSON payload See Arguments (customer site fields).

Outputs

None.

Delete a customer WiFi network

Method URL Description Arguments Outputs

POST /customers/{cid}/sites/ Delete the customer WiFi See the next table none
{sid}/wifinetworks/delete/ network.
{wifiNetworkId}

Arguments

Parameter Type Description

cid int Customer ID.

sid int Site ID.

FortiPortal 7.0.0 REST API Guide 54


Fortinet Inc.
API reference

Outputs

None.

System provisioning

These API endpoints allow you to retrieve system-provisioning information.

Get all devices

Method URL Description Arguments Outputs

GET /devices or /devices?status= Retrieve all devices none required JSON array

GET /devices?haRole=master Retrieve the primary haRole JSON array


and /devices?haRole=slave devices or the secondary
devices, depending on the
value specified.

GET /devices?status=available Retrieve the devices that status JSON array


can be assigned to
customer sites

Arguments

Parameter Type Description

haRole string If the value is primary, all primary devices are returned. If the value
is secondary, all secondary devices are returned. NOTE: the values
are case sensitive; use all lower-case letters for primary and
secondary.

status string If no value is specified, all devices are returned. If the value is
available, the devices that can be assigned to customer sites are
returned.

Outputs

Parameter Type Description

deviceId int Device ID.

deviceName String Name of the device.

customerName String Customer name or empty.

serialNumber String The serial number of the device.

FortiPortal 7.0.0 REST API Guide 55


Fortinet Inc.
API reference

Parameter Type Description

haRole String The role of the device, either primary or secondary.

version String The value is orignal, new, or old. Devices with a new or
original version can be assigned to the customer if they are not
associated with any other customer.

customerId String Customer ID if the device is assigned to a customer,


otherwise empty

Get all ADOMs

Method URL Description Arguments Outputs

GET /adoms Retrieve all ADOMs and the none JSON array
customers assigned to each
one.

Arguments

None.

Outputs

Parameter Type Description

customers JSON object List of customer ID and customer names assigned to the adom

adom String ADOM name

Get all roles

Method URL Description Arguments Outputs

GET /roles Retrieve all roles none JSON array

Arguments

None.

FortiPortal 7.0.0 REST API Guide 56


Fortinet Inc.
API reference

Outputs

Parameter Type Description

rolesId int Role ID.

rolesName String Name of the roles.

rolesType String Type of role, SP or CUST

roleCreateType String Default or custom.

Get information for a specified role

Method URL Description Arguments Outputs

GET /roles/{roleId} Retrieve the specified role roleId See the Outputs
table.

Arguments

Parameter Type Description

roleId int Role ID.

Outputs

Parameter Type Description

roleId int Role ID.

roleName String Name of the roles.

roleType String Type of role, SP or CUST

roleCreateType String Default or custom.

Permissions JSON array Each entry includes the permission name and permission ID.

Get all FAPs

Method URL Description Arguments Outputs

GET /faps Retrieve all Fortinet APs none JSON array

Arguments

None.

FortiPortal 7.0.0 REST API Guide 57


Fortinet Inc.
API reference

Outputs

Parameter Type Description

fapName String Name of the Fortinet AP.

serialNumber String Serial Number of the Fortinet AP

osVersion String OS Version.

customerId int Customer ID.

fapId int ID of the Fortinet AP.

Get audit logs

Method URL Description Arguments Outputs

GET /auditlogs?Start_date= "MM/dd/yyyy" &End_date= Retrieve the See the next JSON array
"MM/dd/yyyy" or /auditlogs?frequencyValue=<time> audit logs for section.
the specified
time range or
the specified
number or
days or hours.

GET /auditlogs?frequencyValue=<time>&pageStart=<ro Retrieve the See the next JSON array


w_number>&pageLength=<number_of_records> specified section.
number of
records for the
specified
number of
days or hours.

Arguments (query parameters)

Parameter Type Description

frequencyValue String The number of hours or days of audit logs. If frequencyValue is not
specified, the default is one day.

NOTE: Provide either the frequencyValue or the Start_date and End_


date.

Start_date datetime Start date. The format is "MM/dd/yyyy". If the date range is not
specified, the default is one day.

NOTE: Provide either the frequencyValue or the Start_date and End_


date.

FortiPortal 7.0.0 REST API Guide 58


Fortinet Inc.
API reference

Parameter Type Description

End_date datetime End date. The format is "MM/dd/yyyy". If the date range is not
specified, the default is one day.

NOTE: Provide either the frequencyValue or the Start_date and End_


date.

pageStart int The starting row number for the records to return. If pageStart is not
specified, the default is 0.

pageLength int The number of records per page to return. If pageLength is not
specified, the default is 100 records per page. The maximum value is
1000 records per page.

The following is the format for frequencyValue:


l For 1 day: “1 00:00:00”
l For 1 hour: “0 01:00:00”
l For 1 week: “7 00:00:00”
To retrieve the first 10 records for one day:
fpc/api/auditlogs?frequencyValue="1 00:00:00"&pageStart=0&pageLength=10

To retrieve the first 1,000 records for seven days:


fpc/api/auditlogs?frequencyValue="7 00:00:00"&pageStart=0&pageLength=1000

Outputs

Parameter Type Description

dataForDate int Date.

level String Level

userName String Name of the user.

eventType String Type of event.

Client_ip_address String Client IP address

message String Message

Get alerts

Method URL Description Arguments Outputs

GET /alerts Retrieve list the alert logs for a See the next table. JSON array
given date range.
By default, returns Alerts for SP
for 1 day range.

FortiPortal 7.0.0 REST API Guide 59


Fortinet Inc.
API reference

Arguments (JSON payload)

Parameter Type Description

userType String SP – for service provider users


CUST – for customer users
Default or no query parameter – returns all users.

frequencyValue String Default in One day (“1 00:00:00”)

customerId int If alert related to customer is needed (userType has to be CUST)

Outputs

Parameter Type Description

alertReceiver String Name of the SP or customer that the receiver for this alert message.

alertType String Level of the alert (warn, info, and so on)

createdOn date Date the alert was received

contentId String Alert message content.

Get cloud usage

Method URL Description Arguments Outputs

GET /cloudusage Retrieve cloud usage for all None See the next table.
customers

Outputs

Parameter Type Description

totalStorage String Total usage for all customers

allocatedStorage String Allocated storage

usedStorage String Storage in MB, GB, and so on

usedStorageinPercentage String Used storage in percentage

totalCustomers String Number of customers

FortiPortal 7.0.0 REST API Guide 60


Fortinet Inc.
API reference

Get cloud usage for a specific customer

Method URL Description Arguments Outputs

GET /cloudusage/{cid} Retrieve cloud usage for the cid See the Outputs
specified customer. table.

Arguments

Parameter Type Description

cid int Customer ID.

Outputs

Parameter Type Description

totalStorage String Total usage for this customer

totalFreeStorage String Free storage

usedStorage String Storage in MB, GB, and so on

usedStorageinPercentage String Used storage in percentage

Get countries

Method URL Description Arguments Outputs

GET /countries Retrieve a list of all countries in None See the next table.
the FortiPortal database.

Outputs

Parameter Type Description

country int Country ID

countryCode String Short code for the country (for example, “US”)

countryName String Country name

FortiPortal 7.0.0 REST API Guide 61


Fortinet Inc.
API reference

Get details for a specific country

Method URL Description Arguments Outputs

GET /countries/ Get details for the specified countryId See below.
{countryId} country.

Arguments

Parameter Type Description

countryId int Country ID.

Outputs

Parameter Type Description

country int Country ID

countryCode String Short code for the country (for example, “US”)

countryName String Country name

Get policy installations by all customers in a specified time range

Method URL Description Arguments Outputs

GET /installs/?startdate=’yyyy- Get policy installations for all startdate, enddate See the following
MM-dd customers in a specified table.
HH:mm:ss’&enddate= time range
’yyyy- MM-dd HH:mm:ss

Arguments

Parameter Type Description

Startdate (required) string Startdate: start of date range. Date format : ‘yyyy-MM-dd HH:mm:ss’

Enddate (required) string Enddate: end of date range. Date format : ‘yyyy-MM-dd HH:mm:ss’

Outputs

Parameter Type Description

country int Country ID

FortiPortal 7.0.0 REST API Guide 62


Fortinet Inc.
API reference

Parameter Type Description

countryCode String Short code for the country (for example, “US”)

countryName String Country name

Users

FortiPortal contains a record for each service provider user and customer user in the system. You can use these API
endpoints to create a new service provider user.

Get all users

Method URL Description Arguments Outputs

GET /users Retrieve all local service userType JSON array


provider and/or customer users
in the FortiPortal

Arguments

Parameter Type Description

userType String SP – for service provider users


CUST – for customer users
Default or no query parameter – returns all users.

Outputs

Parameter Type Description

userId int user ID.

user Name String Name of the site.

firstName String First Name of the contact person.

lastName String Last Name of the contact person.

email String Email address of the contact.

userType String Type of user (customer or SP)

status String User status (active or inactive).

roles JSON array Roles assigned to the user.

FortiPortal 7.0.0 REST API Guide 63


Fortinet Inc.
API reference

Create a service provider user

Method URL Description Arguments Outputs

POST /users Create a new service provider See the next table. userId
user

Arguments (JSON payload)

Parameter Type Required Description

userName String Name of the site.

firstName String Y First Name of the contact person.

lastName String Y Last Name of the contact person.

email String Y Email address of the contact.

password String Password for the user.

address1 String Address line 1

address2 String Address line 2

city String Name of the city

state String Name of the state

zip String Postal code

country String Country

phone String Phone number for the user

fax String Fax number for the user

email String Y Email address of the contact person.

userType String Type of user. Enter SP.

pwdEnable boolean Password policy

roles JSON array Array of user roles.

Outputs

Parameter Type Description

userId int user ID.

FortiPortal 7.0.0 REST API Guide 64


Fortinet Inc.
API reference

Utility widget

A validation exists to check for valid widgetId, which are of type "CUST." The following API can be used to acquire a list
of all widgets that can be applied to the customer.

List all widgets resource by type

Method URL Description Arguments Outputs

GET /customers/ List all widgets resource type See the Outputs
{cid}/widgets/?type=<type> of type (either SP or table.
CUST depending upon
query parameter (SP,
default))

Arguments

Parameter Type Description

type string Type of widget Customer “CUST” or Service provider “SP”

Outputs

HTTP Response 200 OK


Response Data:

Parameter Type Description

widgetId int Widget ID

uid string Unique identifier name for widget

name string Name of widget

type string SP or CUST

License

Upload a license file

Method URL Description Arguments Outputs

POST /license Uploads a license file as a licenseFile See Outputs table.


mutipart/form-data

FortiPortal 7.0.0 REST API Guide 65


Fortinet Inc.
API reference

Arguments

Parameter Type Required Description

licenseFile .lic Yes License file to be uploaded (as part of form-data)

Outputs

Parameter Type Description

location string Location

message string Message whether the license was uploaded successfully

Retrieve license information

Method URL Description Arguments Outputs

GET /license Retrieve license information none See Outputs table.

Arguments

None

Outputs

Parameter Type Description

vmLicense string License status

numberOfDevicesAllowed int Number of devices allowed

numberOfFAPDevicesAllowed int Number of FortiAP devices allowed

numberOfSandboxDevicesUsed int Number of FortiSandbox devices used

expiryDate string License expiry date and time

fpcSerialNumber string FortiPortal serial number

FortiPortal 7.0.0 REST API Guide 66


Fortinet Inc.
API examples

You can access the API from most browsers using the GET method.
The examples in this chapter make requests using cURL, which is more flexible than using a browser alone, works
across platforms, and most scripts can call it. Using cURL is not as flexible as native scripting languages, but it is useful
for illustrating how the API functions.

Log in

Request

POST https://<ip address>:<port>/fpc/api/login

Headers

Content-type: application/json

Payload

{
“user” : “spuser”,
“password” : “test123”
}

Response

Status : 200 OK
{
“sid” : “8478V00xYhva_ndcihDi203ru3c1auaUb1icew0W_TT”
}

Create a new site

This example shows how to create a new site for the customer with ID.

Request

POST https://<ip address>:<port>/fpc/api/customers/1/sites

FortiPortal 7.0.0 REST API Guide 67


Fortinet Inc.
API examples

Headers

Content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Payload

{
“networkName” : “site1”,
“contactName” : “Peter”,
“contactEmail” : peter@fortinet.com,
“contactPhone” : “408-235-7700”
“fpcDeviceModels”: [ {"deviceId" : 3},{"deviceId" : 2}]
}

Response

Status : 200 OK
{
“networked” : 5
}

Comment-based and name-based filters

Get a list of filters assigned to a specific customer

Request

GET http://localhost:8080/fpc/api/customers/{cid}/commentnamebasedfilters

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Response

{
"customerId" : 6,
"commentBasedFilter" : ["new1", "hello1"],
"nameBasedFilter" : ["go", "good"]
}

FortiPortal 7.0.0 REST API Guide 68


Fortinet Inc.
API examples

Update the filters assigned to a specific customer

Request

POST http://localhost:8080/fpc/api/customers/{cid}/commentnamebasedfilters

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Payload

{
"customerId" : 6,
"commentBasedFilter" : ["new filters", "pfilter"],
"nameBasedFilter" : ["objfilter1", "cs22"]
}

Response

Status 200 OK

Validation

If domain names are not unique, more than 10, or does not satisfy characters criteria, it will respond as Status 400 Bad
Request and with message as follows:
l {"domainNames": "Domain Name must be unique, xyz.com,def.com already exists"}
l {"domainNames": "Domain Name (xdfd23232!@#yzcom) is Invalid"}
l { "domainNames": "Domain Names count reached max limit of 10"}

Customers domain

GET example

Request

GET http://localhost:8080/fpc/api/customers/1/domains

FortiPortal 7.0.0 REST API Guide 69


Fortinet Inc.
API examples

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Response

{
"domainId": 1,
"domainNames": [
"abc.com",
"test.com",
"hello.com"
],
"type": "CUST",
"customerId": 1
}

POST example (update domains)

Request

POST http://localhost:8080/fpc/api/customers/1/domains

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Payload

{
"domainNames": [
"abc.com",
"xyz.com"
],
"customerId": 1
}

Response

Status 200 OK

FortiPortal 7.0.0 REST API Guide 70


Fortinet Inc.
API examples

Validation

If domain names are not unique, more than 10, or does not satisfy characters criteria, it will respond as Status 400 Bad
Request and with message as follows:
l {"domainNames": "Domain Name must be unique, xyz.com,def.com already exists"}
l {"domainNames": "Domain Name (xdfd23232!@#yzcom) is Invalid"}
l { "domainNames": "Domain Names count reached max limit of 10"}

Customers tab permission

GET example

Request

GET http://localhost:8080/fpc/api/customers/1/tabs

Headers

accept: application/json
content-type: application/json
fpc-sid: F08B913D590835973279E4F035C0DC03
Cookie: fpc-jsessionid=F08B913D590835973279E4F035C0DC03

Response

{
"id": 1,
"dashboard": true,
"view": true,
"wifi": false,
"reports": true,
"policy": true,
"objects": true,
"additionalResources": true,
"deviceManager": false,
"auditLogs": true,
"customerId": 1
}

POST example (update tab permissions)

Request

POST http://localhost:8080/fpc/api/customers/1/tabs HTTP/1.1

FortiPortal 7.0.0 REST API Guide 71


Fortinet Inc.
API examples

Headers

accept: application/json
content-type: application/json
fpc-sid: F08B913D590835973279E4F035C0DC03
Cookie: fpc-jsessionid=F08B913D590835973279E4F035C0DC03

Payload

{
"id": 1,
"dashboard": true,
"view": true,
"wifi": true,
"reports": true,
"policy": false,
"objects": true,
"additionalResources": true,
"deviceManager": true,
"auditLogs": true,
"customerId": 1
}

If Analytics is enabled dashboard, view and reports will always be true (even if it is set false in JSON payload it will
override) and vice-versa.

Response

Status 200 OK

Customers policy tab permission

GET example

Request

GET http://localhost:8080/fpc/api/customers/1/policytabs

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

FortiPortal 7.0.0 REST API Guide 72


Fortinet Inc.
API examples

Response

{
"centralNat": false,
"interfacePolicy6": false,
"dosPolicy6": false,
"policy64": false,
"interfacePolicy": false,
"policy6": false,
"dosPolicy": true,
"policy46": false,
"id": 1,
"customerId": 1
}

POST example (update policy tab permissions)

Request

POST http://localhost:8080/fpc/api/customers/1/policytabs

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Payload

{
"centralNat": false,
"interfacePolicy6": false,
"dosPolicy6": false,
"policy64": false,
"interfacePolicy": false,
"policy6": false,
"dosPolicy": false,
"policy46": true,
"customerId": 1
}

Response

Status 200 OK

FortiPortal 7.0.0 REST API Guide 73


Fortinet Inc.
API examples

Customers policy and objects permission

GET example

Request

GET http://localhost:8080/fpc/api/customers/1/policyobjects

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Response

{
"id": 1,
"customerId": 1,
"webfilter": false,
"applicationControl": false,
"antiSpam": false,
"dlp": false,
"firewallAddress": false,
"schedule": false,
"policyObjectWrite": false,
"ipsSensor": false,
"antivirus": false,
"user": false,
"userGroup": false,
"vip": false,
"localCategory": false,
"ratingOverrides": false,
"service": false
}

POST example (update tab permissions)

Request

POST http://localhost:8080/fpc/api/customers/1/policytabs

Headers
accept: application/json
content-type: application/json

FortiPortal 7.0.0 REST API Guide 74


Fortinet Inc.
API examples

fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Payload

{
"webfilter": true,
"applicationControl": false,
"antiSpam": false,
"dlp": false,
"firewallAddress": true,
"schedule": true,
"policyObjectWrite": true,
"ipsSensor": false,
"antivirus": false,
"user": false,
"userGroup": false,
"vip": false,
"localCategory": true,
"ratingOverrides": false,
"service": false
"customerId": 1
}

Response

Status 200 OK

Customers widget permission

GET example

Request

GET http://localhost:8080/fpc/api/customers/1/widgets

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Response

{
"widgetPermissionId" : 1,
"customerId" : 1,

FortiPortal 7.0.0 REST API Guide 75


Fortinet Inc.
API examples

"widgets" : [{
"widgetId" : 4,
"name" : "Top Application Category",
"uid" : "topAppCategory"
}, {
"widgetId" : 7,
"name" : "Top Web",
"uid" : "topWeb"
}
]
}

POST example (update domains)

Request

POST http://localhost:8080/fpc/api/customers/1/widgets

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Payload

{
"customerId" : 1,
"widgets" : [{
"widgetId" : 4
}, {
"widgetId" : 7
}
]
}

Response

Status 200 OK

FortiPortal 7.0.0 REST API Guide 76


Fortinet Inc.
API examples

Widget

GET example

Request

GET http://localhost:8080/fpc/api/widgets/?type=CUST

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Response

[
{
"name": "Top Application Category",
"uid": "topAppCategory",
"widgetId": 4,
"type": "CUST"
},
{
"name": "Top Hostname By Traffic",
"uid": "topHNByTraffic",
"widgetId": 5,
"type": "CUST"
},
………..
…………
………….
{
"name": "Top Region By Traffic",
"uid": "topRegionByTraffic",
"widgetId": 6,
"type": "CUST"
}
]

FortiPortal 7.0.0 REST API Guide 77


Fortinet Inc.
API examples

Customers ADOM list

GET example

Request

GET http://localhost:8080/fpc/api/customers/1/adoms

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Response

{
"id": 1,
"customerId": 1,
"adoms": [
"Forti/Adom4_Test",
"Forti/Adom3_Test"
]
}

POST example (update domains)

Request

POST http://localhost:8080/fpc/api/customers/1/adoms

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Payload

{
"customerId": 1,
"adoms": [
"Forti/Adom1_Test",
"Forti/Adom4_Test",
"Forti/Adom3_Test"

FortiPortal 7.0.0 REST API Guide 78


Fortinet Inc.
API examples

]
}

Response

Status 200 OK

Customers policy installation

GET all example

Request

GET http://localhost:8080/fpc/api/customers/2/installs?startdate=2016-11-14
12:38:08&enddate=2016-1Z1-24 15:38:08

Headers

accept: application/jsonz
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Response

Status 200 OK
[{
"id" : 3,
"taskId" : 681,
"customerId" : 2,
"customerName" : "customer two",
"userid" : 1,
"userName" : "system-generated",
"deviceName" : "FGVM010000051257",
"packageName" : "FGT168_LB_root",
"vdomName" : "root",
"taskDetails" : "Policy package FGT168_LB_root install to device FGVM010000051257and vdom
root started with taskId 681",
"adomName" : "Adom5_LB",
"fortimanagerId" : 1,
"createdOn" : 1479780232000
}, {
"id" : 4,
"taskId" : 682,
"customerId" : 2,
"customerName" : "customer two",
"userid" : 1,
"userName" : "system-generated",

FortiPortal 7.0.0 REST API Guide 79


Fortinet Inc.
API examples

"deviceName" : "FGVM010000051257",
"packageName" : "FGT168_LB_root",
"vdomName" : "root",
"taskDetails" : "Policy package FGT168_LB_root install to device FGVM010000051257and vdom
root started with taskId 682",
"adomName" : "Adom5_LB",
"fortimanagerId" : 1,
"createdOn" : 1479929677000
}]

GET installation details by ID

Request

POST http://localhost:8080/fpc/api/customers/2/installs/4

Headers

accept: application/json
content-type: application/json
fpc-sid: $FPCSID
Cookie: fpc-jsessionid=$FPCSID

Response

Status 200 OK
{
"installId": 4,
"taskId": 682,
"customerId": 2,
"customerName": "customer two",
"installationLog": " Starting log (Run on device) Start installing FGVM010000051257 $
config vdom FGVM010000051257 (vdom) $ edit root current vf=root:0 FGVM010000051257
(root) $ config firewall policy FGVM010000051257 (policy) $ delete 21
FGVM010000051257 (policy) $ end FGVM010000051257 (root) $ end FGVM010000051257 $
config vdom FGVM010000051257 (vdom) $ edit root current vf=root:0 FGVM010000051257
(root) $ config firewall ssl-ssh-profile FGVM010000051257 (ssl-ssh-profile) $ delete
"_2_default_default_" FGVM010000051257 (ssl-ssh-profile) $ end FGVM010000051257
(root) $ end ---> generating verification report <--- done generating verification
report install finished ",
"errorCode": "0",
"errorMsg": "Get Install Log Successfully"
}

FortiPortal 7.0.0 REST API Guide 80


Fortinet Inc.
API examples

Display all customers

Request

GET https://<ip address>:<port>/fpc/api/customers

Headers

Content-type: application/json
fpc-sid: $FPCSID”
Cookie: fpc-jsessionid=$FPCSID

Response

[
{
"customerId": 3,
"customerName": "abc",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": "",
"phone": "",
"fax": "",
"contactFname": "abc",
"contactLname": "abc",
"contactEmail": "abc@abc.com",
"status": "A",
"totalStorage": 5,
"fpcStorage": 1,
"collectorStorage": 4,
"collectorStoragePercentage": 80,
"fpcStorageUsage": 0,
"collectorStorageUsage": 0,
"locale": "en",
"storageType": "GB",
"analyticsEnabled": "Y"
},
{
"customerId": 2,
"customerName": "Customer1",
"address1": "",
"address2": "",
"city": "",
"state": "",
"zip": "",
"phone": "",
"fax": "",
"contactFname": "Customer",
"contactLname": "one",
"contactEmail": "customer@customer.com",
"status": "A",

FortiPortal 7.0.0 REST API Guide 81


Fortinet Inc.
API examples

"totalStorage": 5,
"fpcStorage": 1,
"collectorStorage": 4,
"collectorStoragePercentage": 80,
"fpcStorageUsage": 8500,
"collectorStorageUsage": 0,
"deviceName": "tenant-2/fgt13/vd3,Adom4/FG_134/root,root/aaa/pravinvd",
"locale": "en",
"storageType": "GB",
"analyticsEnabled": "Y"
}
]

Status : 200 OK

FortiAnalyzer reports

Get unassigned FortiAnalyzer reports that the specified customer can assign

Request

GET http://localhost:8080/fpc/api/customers/1/availablefazreports

Headers

accept: application/json
content-type: application/json
fpc-sid: 9F6FDBC7A65806CFA2322CA525CF912F
Cookie: fpc-jsessionid=$FPCSID

Response

{
"ipAddress": null,
"reportName": "360-Degree Security Review",
"startTime": null,
"endTime": null,
"fazName": "FAZ_TEST",
"adom": "ADOM_TEST",
"reportId": 319,
"customerId": null,
"fazId": 3,
"customerName": null,
"devices": null
}

FortiPortal 7.0.0 REST API Guide 82


Fortinet Inc.
API examples

Get FortiAnalyzer reports that are assigned to the specified customer

Request

GET http://localhost:8080/fpc/api/customers/2/assignedfazreports

Headers

accept: application/json
content-type: application/json
fpc-sid: 9F6FDBC7A65806CFA2322CA525CF912F
Cookie: fpc-jsessionid=$FPCSID

Response

{
"ipAddress": null,
"reportName": "360-Degree Security Review",
"startTime": null,
"endTime": null,
"fazName": "FAZ_TEST",
"adom": "ADOM_TEST",
"reportId": 319,
"customerId": 2,
"fazId": 3,
"customerName": TEST_customer,
"devices": null
}

Assign FortiAnalyzer reports to a customer

Request

POST http://localhost:8080/fpc/api/customers/3/assignfazreports

Headers

accept: application/json
content-type: application/json
fpc-sid: 9F6FDBC7A65806CFA2322CA525CF912F
Cookie: fpc-jsessionid=$FPCSID

Payload

[319,303]

FortiPortal 7.0.0 REST API Guide 83


Fortinet Inc.
API examples

Response

Status 200 OK

Unassign FortiAnalyzer reports from a customer

Request

POST http://localhost:8080/fpc/api/customers/3/unassignfazreports

Headers

accept: application/json
content-type: application/json
fpc-sid: 9F6FDBC7A65806CFA2322CA525CF912F
Cookie: fpc-jsessionid=$FPCSID

Payload

[319,303]

Response

Status 200 OK

Get all FortiAnalyzer units

Request

GET http://localhost:8080/fpc/api/fortianalyzers

Headers

accept: application/json
content-type: application/json
fpc-sid: 5CE163D9F2D2C185843C77C6DE2DE2A4
Cookie: fpc-jsessionid=$FPCSID

Response

[{
"adminUserName": "boweiliu",
"fazVersion": null,
"name": "jad",
"ipAddress": "0.0.0.0",

FortiPortal 7.0.0 REST API Guide 84


Fortinet Inc.
API examples

"id": 1,
"status": "D"
},
{
"adminUserName": "admin",
"fazVersion": "v6.0.4-build0292 190109 (GA)",
"name": "FAZ",
"ipAddress": "10.106.6.214",
"id": 3,
"status": "A"
}
]

Get detailed information for a specific FortiAnalyzer

Request

GET http://localhost:8080/fpc/api/fortianalyzers/1

Headers

accept: application/json
content-type: application/json
fpc-sid: 5CE163D9F2D2C185843C77C6DE2DE2A4
Cookie: fpc-jsessionid=$FPCSID

Response

{
"id": 1,
"name": "Faz1",
"ipAddress": "10.106.6.214",
"adminUserName": "admin",
"status": "A",
"lastRunTime": 1553263143000,
"xmlPort": 8080,
"jsonPort": 443,
"fazVersion": "v6.0.4-build0292 190109 (GA)"
}

Add a new FortiAnalyzer to FortiPortal

Request

POST http://localhost:8080/fpc/api/fortianalyzers

Headers

accept: application/json

FortiPortal 7.0.0 REST API Guide 85


Fortinet Inc.
API examples

content-type: application/json
fpc-sid: 5CE163D9F2D2C185843C77C6DE2DE2A4
Cookie: fpc-jsessionid=$FPCSID

Payload

{
"name": "testRestAPI",
"ipAddress": "10.106.6.217",
"adminUserName": "admin",
"adminPassword": "admin123",
"jsonPort": 443,
}

Response

{
"fazId": 3
}

Edit the information for an existing FortiAnalyzer

Request

POST http://localhost:8080/fpc/api/fortianalyzers/3

Headers

accept: application/json
content-type: application/json
fpc-sid: 5CE163D9F2D2C185843C77C6DE2DE2A4
Cookie: fpc-jsessionid=$FPCSID

Payload

{
"name": "testChangeNameRestAPI",
"ipAddress": "10.106.6.217",
"adminUserName": "admin",
"adminPassword": "admin123",
"jsonPort": 443
}

Response

Status 200 OK

FortiPortal 7.0.0 REST API Guide 86


Fortinet Inc.
API examples

Remove a FortiAnalyzer from FortiPortal

Request

DELETE http://localhost:8080/fpc/api/fortianalyzers/3

Headers

accept: application/json
content-type: application/json
fpc-sid: 5CE163D9F2D2C185843C77C6DE2DE2A4
Cookie: fpc-jsessionid=$FPCSID

Response

Status 200 OK

Update the list of FortiAnalyzer reports

Request

GET http://localhost:8080/fpc/api/fortianalyzers/3/pollnow

Headers

accept: application/json
content-type: application/json
fpc-sid: 5CE163D9F2D2C185843C77C6DE2DE2A4
Cookie: fpc-jsessionid=$FPCSID

Response

Status 200 OK

List FortiAnalyzer report templates for a specific FortiAnalyzer

Request

GET http://localhost:8080/fpc/api/fortianalyzers/3/reporttemplates

Headers

accept: application/json
content-type: application/json

FortiPortal 7.0.0 REST API Guide 87


Fortinet Inc.
API examples

fpc-sid: 5CE163D9F2D2C185843C77C6DE2DE2A4
Cookie: fpc-jsessionid=$FPCSID

Response

[{
"fazId": null,
"reportName": "360-Degree Security Review",
"reportId": null,
"fazName": null,
"customerId": null,
"adom": "ADOM_FAZ_60X_60_FOR_CI",
"customerName": ""
},
{
"fazId": null,
"reportName": "Admin and System Events Report",
"reportId": null,
"fazName": null,
"customerId": null,
"adom": "ADOM_FAZ_60X_60_FOR_CI",
"customerName": ""
}
]

Support license upload

This example shows how to upload a license file as a mutipart/form-data.

Request

POST https://<ip address>:<port>/fpc/api/license


multipart/form-data; name="licenseFile"
value = license file

Headers

accept: application/json
Content-type: application/json
fpc-sid: $FPCSID
Cookie: JSESSIONID=$FPCSID

Response

json
201 Created
Response Header:
Location: http://localhost/fpc/api/license

FortiPortal 7.0.0 REST API Guide 88


Fortinet Inc.
API examples

Content-Type: application/json;charset=UTF-8
Date: Tue, 12 Oct 2021 17:52:28 GMT
Content-Length: 87

Message Body

{
"location": "http://localhost/fpc/api/license",
"message": "license uploaded succefully"
}

License information

This example shows how to retrieve license information.

Get example

Request

GET http://localhost:8080/fpc/api/license

Headers

accept: application/json
Content-type: application/json
fpc-sid: $FPCSID
Cookie: JSESSIONID=$FPCSID

Response

{
"vmLicense": "valid",
"numberOfDevicesAllowed": "100 [5]",
"numberOfFAPDevicesAllowed": "1000 [0]",
"numberOfSandboxDevicesUsed": 0,
"expiryDate": "Sat Apr 07 21:40:29 2029 GMT",
"fpcSerialNumber": "FPC-VM7777778880"
}

FortiPortal 7.0.0 REST API Guide 89


Fortinet Inc.
www.fortinet.com

Copyright© 2022 Fortinet, Inc. All rights reserved. Fortinet®, FortiGate®, FortiCare® and FortiGuard®, and certain other marks are registered trademarks of Fortinet, Inc., and other Fortinet names herein
may also be registered and/or common law trademarks of Fortinet. All other product or company names may be trademarks of their respective owners. Performance and other metrics contained herein were
attained in internal lab tests under ideal conditions, and actual performance and other results may vary. Network variables, different network environments and other conditions may affect performance
results. Nothing herein represents any binding commitment by Fortinet, and Fortinet disclaims all warranties, whether express or implied, except to the extent Fortinet enters a binding written contract,
signed by Fortinet’s General Counsel, with a purchaser that expressly warrants that the identified product will perform according to certain expressly-identified performance metrics and, in such event, only
the specific performance metrics expressly identified in such binding written contract shall be binding on Fortinet. For absolute clarity, any such warranty will be limited to performance in the same ideal
conditions as in Fortinet’s internal lab tests. Fortinet disclaims in full any covenants, representations, and guarantees pursuant hereto, whether express or implied. Fortinet reserves the right to change,
modify, transfer, or otherwise revise this publication without notice, and the most current version of the publication shall be applicable.

You might also like