Fortinet black logo

Accessing the API

Accessing the API

Create HTTP requests in the following format:

https://<ipaddress>/fpc/v1/api/<resources>

Headers

Each request must contain the following HTTP header fields:

  • Content-type: application/json
  • Authorization: Token <API_key as obtained from FortiPortal GUI>

The Authorization header is mandatory in all API calls.

See Authentication for more information.

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 organization sites), the URL may contain more than one index (one for organization 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
  • Optionally, a JSON string depending on the API method.

Failure response structure

API returns the following values in a failure response message:

  • HTTP status 4xx or 500
  • A JSON string with the error details

Accessing the API

Create HTTP requests in the following format:

https://<ipaddress>/fpc/v1/api/<resources>

Headers

Each request must contain the following HTTP header fields:

  • Content-type: application/json
  • Authorization: Token <API_key as obtained from FortiPortal GUI>

The Authorization header is mandatory in all API calls.

See Authentication for more information.

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 organization sites), the URL may contain more than one index (one for organization 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
  • Optionally, a JSON string depending on the API method.

Failure response structure

API returns the following values in a failure response message:

  • HTTP status 4xx or 500
  • A JSON string with the error details