Fortinet black logo

Accessing the API

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:

  • Content-type: application/json
  • 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.

Success response structure

API returns the following values in a successful response message:

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

Failure response structure

API returns the following values in a failure response message:

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

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:

  • Content-type: application/json
  • 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.

Success response structure

API returns the following values in a successful response message:

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

Failure response structure

API returns the following values in a failure response message:

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