Fortinet Document Library

Version:

Version:

Version:

Version:

Version:


Table of Contents

API Reference

This section shows how to use FMGApiCli to integrate the FortiManager Integration App with other ServiceNow apps.

API calls to the app use the ServiceNow API credentials configured in FortiManager System Properties. No further authentication is done.

Caution

API calls are allowed from anywhere in the ServiceNow platform. Consider limiting access to ServiceNow scripts to users with authorization to create FortiManager change requests.

There are three APIs through FMGApiCli for inbound integration:

  • CreateScript - creates and executes scripts and configuration installations.
  • CheckExec - checks script execution status on FortiManager.
  • CheckDeploy - checks configuration installation status on FortiManager.

FMGApiCli provides a SendRestRequest function to send the “request object” to FortiManager Integration App.

This section shows the format to construct the “request object” and then use FMGApiCli.SendRestRequest(obj) to send the request. FortiManager Integration App returns a response to caller.

Using CreateScript

Request object

Request parameters

Name

Description

method

Should be “POST

params

url

Should be “CreateScript

adom

The ADOM which the script template belongs to.

script

Name of script template in FortiManager GUI.

description

Description of this new change.

scriptVars

Optional: If a script template includes variables, specify the value of variables.

devices

Optional: If the type of script is device_database or remote_device, specify the name of devices.

Policy

Optional: If the type of script is adom_database, specify the name of policies.

Response object

Response parameters

Name

Description

Id

Reserved field. Not currently used.

result

data

Response from FortiManager web API.

httpStatus

HTTP status of response from Import Set Web Service.

bodyObj

httpStatus

HTTP status of response from Import Set Web Service.

bodyObj

Response from Import Set Web Service.

transform

Import Set Table.

Table

ServiceNow table to store changes request.

display_name

Field name of identity column in ServiceNow. In ServiceNow, this is called “number”.

display_value

Unique ID for tracking record in ServiceNow.

record_link

Link to view the record in ServiceNow GUI.

status

Operation of table.

sys_id

System ID in ServiceNow.

Status

Status of response from Import Set Web Service.

code

code

message

message

status

Status of response from FortiManager Integration App web API.

code

Status code

message

Message

url

FortiManager Integration App web API endpoint.

Sample CreateScript request

Sample CreateScript response

FortiManager Changes page in GUI

Using CheckExec

Request object

Request parameters

Name

Description

method

Should be “POST

params

url

Should be “CheckExec

number

The unique tracking string for ServiceNow table. It can be retrieved from the display_value variable from “Create Script” response.

Response object

Response parameters

Name

Description

Id

Reserved field. Not currently used.

result

data

Response from FortiManager web API.

httpStatus

HTTP status of response from Import Set Web Service.

bodyObj

data

Response from Import Set Web Service.

adom ADOM which scripts belongs to.
number Unique tracking ID in ServiceNow table.
sys_updated_on Last update time.
exec_script_task_id Tracking ID for execution task.
exec_script_status Status of script execution.
exec_script_percent Percentage of script execution.

Status

Status of response from Import Set Web Service.

code

code

message

message

status

Status of response from FortiManager Integration App web API.

code

Status code

message

Message

url

FortiManager Integration App web API endpoint.

Sample CheckExec request

Sample CheckExec response

FortiManager Changes Details page in GUI

Using CheckDeploy

Request object

Request parameters

Name

Description

method

Should be “POST

params

url

Should be “CheckDeploy

number

The unique tracking string for ServiceNow table. It can be retrieved from the display_value variable from “Create Script” response.

Response object

Response parameters

Name

Description

Id

Reserved field. Not currently used.

result

data

Response from FortiManager web API.

httpStatus

HTTP status of response from Import Set Web Service.

bodyObj

data

Response from Import Set Web Service.

adom ADOM which scripts belongs to.
number Tracking ID in ServiceNow table.
sys_updated_on Last update time.
deploy_script_task_id Tracking id for deployment task.
deploy_script_status Status of script deployment.
deploy_script_percent Percentage of script deployment.

Status

Status of response from Import Set Web Service.

code

code

message

message

status

Status of response from FortiManager Integration App web API.

code

Status code

message

Message

url

FortiManager Integration App web API endpoint.

Sample CheckDeploy request

Sample CheckDeploy response

FortiManager Changes Details page in GUI

API Reference

This section shows how to use FMGApiCli to integrate the FortiManager Integration App with other ServiceNow apps.

API calls to the app use the ServiceNow API credentials configured in FortiManager System Properties. No further authentication is done.

Caution

API calls are allowed from anywhere in the ServiceNow platform. Consider limiting access to ServiceNow scripts to users with authorization to create FortiManager change requests.

There are three APIs through FMGApiCli for inbound integration:

  • CreateScript - creates and executes scripts and configuration installations.
  • CheckExec - checks script execution status on FortiManager.
  • CheckDeploy - checks configuration installation status on FortiManager.

FMGApiCli provides a SendRestRequest function to send the “request object” to FortiManager Integration App.

This section shows the format to construct the “request object” and then use FMGApiCli.SendRestRequest(obj) to send the request. FortiManager Integration App returns a response to caller.

Using CreateScript

Request object

Request parameters

Name

Description

method

Should be “POST

params

url

Should be “CreateScript

adom

The ADOM which the script template belongs to.

script

Name of script template in FortiManager GUI.

description

Description of this new change.

scriptVars

Optional: If a script template includes variables, specify the value of variables.

devices

Optional: If the type of script is device_database or remote_device, specify the name of devices.

Policy

Optional: If the type of script is adom_database, specify the name of policies.

Response object

Response parameters

Name

Description

Id

Reserved field. Not currently used.

result

data

Response from FortiManager web API.

httpStatus

HTTP status of response from Import Set Web Service.

bodyObj

httpStatus

HTTP status of response from Import Set Web Service.

bodyObj

Response from Import Set Web Service.

transform

Import Set Table.

Table

ServiceNow table to store changes request.

display_name

Field name of identity column in ServiceNow. In ServiceNow, this is called “number”.

display_value

Unique ID for tracking record in ServiceNow.

record_link

Link to view the record in ServiceNow GUI.

status

Operation of table.

sys_id

System ID in ServiceNow.

Status

Status of response from Import Set Web Service.

code

code

message

message

status

Status of response from FortiManager Integration App web API.

code

Status code

message

Message

url

FortiManager Integration App web API endpoint.

Sample CreateScript request

Sample CreateScript response

FortiManager Changes page in GUI

Using CheckExec

Request object

Request parameters

Name

Description

method

Should be “POST

params

url

Should be “CheckExec

number

The unique tracking string for ServiceNow table. It can be retrieved from the display_value variable from “Create Script” response.

Response object

Response parameters

Name

Description

Id

Reserved field. Not currently used.

result

data

Response from FortiManager web API.

httpStatus

HTTP status of response from Import Set Web Service.

bodyObj

data

Response from Import Set Web Service.

adom ADOM which scripts belongs to.
number Unique tracking ID in ServiceNow table.
sys_updated_on Last update time.
exec_script_task_id Tracking ID for execution task.
exec_script_status Status of script execution.
exec_script_percent Percentage of script execution.

Status

Status of response from Import Set Web Service.

code

code

message

message

status

Status of response from FortiManager Integration App web API.

code

Status code

message

Message

url

FortiManager Integration App web API endpoint.

Sample CheckExec request

Sample CheckExec response

FortiManager Changes Details page in GUI

Using CheckDeploy

Request object

Request parameters

Name

Description

method

Should be “POST

params

url

Should be “CheckDeploy

number

The unique tracking string for ServiceNow table. It can be retrieved from the display_value variable from “Create Script” response.

Response object

Response parameters

Name

Description

Id

Reserved field. Not currently used.

result

data

Response from FortiManager web API.

httpStatus

HTTP status of response from Import Set Web Service.

bodyObj

data

Response from Import Set Web Service.

adom ADOM which scripts belongs to.
number Tracking ID in ServiceNow table.
sys_updated_on Last update time.
deploy_script_task_id Tracking id for deployment task.
deploy_script_status Status of script deployment.
deploy_script_percent Percentage of script deployment.

Status

Status of response from Import Set Web Service.

code

code

message

message

status

Status of response from FortiManager Integration App web API.

code

Status code

message

Message

url

FortiManager Integration App web API endpoint.

Sample CheckDeploy request

Sample CheckDeploy response

FortiManager Changes Details page in GUI