Skip to main content
Ahmed_Galal
Staff
Staff
July 17, 2026

Technical Tip: How to query real-server status for a FortiWeb server policy using the REST API

  • July 17, 2026
  • 0 replies
  • 16 views

Description

This article describes how to use the FortiWeb REST API to query the status of real servers associated with a server policy.

Scope

FortiWeb.

Solution

Step 1: Generate the authorization token.
FortiWeb API requests can be authenticated by placing a Base64-encoded JSON object containing the administrator credentials and VDOM in the HTTP Authorization header.

On Linux or macOS, generate the encoded value with:

echo -n '{"username":"admin","password":"fortinet","vdom":"root"}' | base64


Note 1: Replace admin, fortinet, and root with the appropriate FortiWeb administrator username, password, and VDOM.

Example output:

eyJ1c2VybmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJmb3J0aW5ldCIsInZkb20iOiJyb290In0K


Note: Base64 encoding does not encrypt the administrator credentials. Protect the generated value as a password and use a dedicated administrator account with the minimum required permissions.

Step (2) Query the real-server status.

Use the following endpoint:

https://FortiWeb-IP/api/v2.0/policy/policystatus.detail?policy_name=PolicyName 


Replace:

  1. <FortiWeb-IP> with the FortiWeb management IP address or hostname.

  2. <PolicyName> with the server-policy name.


A curl version of the API query should look like this:

curl -k https://10.109.19.9/api/v2.0/policy/policystatus.detail?policy_name=ENRGY-TESZT -H "authorization:eyJ1c2VybmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJmb3J0aW5ldCIsInZkb20iOiJyb290In0K"


The result should look like this:

{ "results": [ { "id": 1, "pool": "Test_pool", "name_route": "app.example.com", "type": 1, "ipDomainName": "10.109.19.30", "port": 443, "healthCheckStatus": "disable", "sessionCount": 0, "backupServer": 0, "status": 1, "server_rtt": 0, "app_response_time": 0 }, { "id": 2, "pool": "Test_pool", "name_route": "app.example.com", "type": 1, "ipDomainName": "10.109.20.8", "port": 443, "healthCheckStatus": "enable", "sessionCount": 0, "backupServer": 0, "status": 1, "server_rtt": 0, "app_response_time": 0 } ] }


POSTMAN version:

9afbc4a5.png


Related article:
Technical Tip: How to generate API Authorization token for FortiWeb

    Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
    Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.