Documentation

FortiManagerAPI

FortiManager API

Tags
link

Fortinet developer ressource center.

Table of Contents

$config  : Config
$session  : string
$transaction  : int|null
$config  : Config
$session  : string
$transaction  : mixed
__construct()  : mixed
Constructor takes care of checking and registering FortiManager's data and login to the API
__destruct()  : mixed
Destructor takes care of logout.
curlRequest()  : stdClass
Method to request the FortiManager's API.
login()  : bool
Login in the FortiManager.
logout()  : Return
Logout from the FortiManager.

Properties

$transaction

public int|null $transaction

Ongoning transaction ID. WARNING : When going through the method prepareRequestData(), all upper case letter in function parameter name will be replaced by '-' and ;brought down to lower case. If you modify or add new endpoints replace all '-' in parameter name by the next letter in uppercase.

Methods

__construct()

Constructor takes care of checking and registering FortiManager's data and login to the API

public __construct(Config $config) : mixed
Parameters
$config : Config

Object containing all necessary configuration.

Return values
mixed

__destruct()

Destructor takes care of logout.

public __destruct() : mixed
Return values
mixed

curlRequest()

Method to request the FortiManager's API.

protected curlRequest(string $method, string $endpoint[, stdClass|array<string|int, mixed> $pathData = null ][, stdClass|array<string|int, mixed> $bodyData = null ][, int $timeout = null ]) : stdClass
Parameters
$method : string

API method for the request. Must be one of those : get, add, set, update, delete, move, clone, exec.

$endpoint : string

API endpoint without the first element ('jsonrpc') and with data in the path not replaced. E.g. /pm/config/adom/{adom}/obj/firewall/address.

$pathData : stdClass|array<string|int, mixed> = null

Data to be passed in the request path.

$bodyData : stdClass|array<string|int, mixed> = null

Params to be passed in the request body.

$timeout : int = null
Return values
stdClass

Return FortiManager's response as a stdClass.

login()

Login in the FortiManager.

private login() : bool
Return values
bool

Return TRUE if successful or throw Exception if fails.

logout()

Logout from the FortiManager.

private logout() : Return
Return values
Return

TRUE if successful, FALSE if it failed.

Search results