Skip to content

Call the PerformanceGuard API

Use the PerformanceGuard REST API to read collected data and manage PerformanceGuard from your own scripts and tools. This page shows you how to find the API documentation, sign in, and set the time interval for data requests.

For an overview of the API, see PerformanceGuard API.

The API documentation is built into PerformanceGuard as an interactive Swagger page.

  1. In a browser, open the PerformanceGuard web interface and sign in.
  2. In the address bar, replace the path with /swagger. For example: https://performanceguard.example.com/swagger.

The Swagger page lists all endpoints, grouped by area, with their parameters and responses. Because you’re signed in, you can select an endpoint and try it directly from the page.

All endpoints are under the /api path of the PerformanceGuard web interface address, for example https://performanceguard.example.com/api/agent. Requests and responses use JSON unless the endpoint says otherwise.

Authenticate in one of two ways.

Send the PerformanceGuard user name and password in a standard HTTP Authorization: Basic header with each request. This is the simplest method for scripts.

Terminal window
$cred = Get-Credential
Invoke-RestMethod -Uri "https://performanceguard.example.com/api/agent?pattern=PC-01" `
-Authentication Basic -Credential $cred

The -Authentication parameter requires PowerShell 7 or newer.

  1. Send a POST request to /api/login with a JSON body that contains username and password.
  2. PerformanceGuard returns a session cookie called JSESSIONID_MERLIN. Include that cookie in the following requests.
  3. When you’re done, send a DELETE request to /api/login to end the session.
Terminal window
$body = @{ username = "api-user"; password = "<password>" } | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "https://performanceguard.example.com/api/login" `
-Body $body -ContentType "application/json" -SessionVariable pg
Invoke-RestMethod -Uri "https://performanceguard.example.com/api/agent?pattern=PC-01" -WebSession $pg
Invoke-RestMethod -Method Delete -Uri "https://performanceguard.example.com/api/login" -WebSession $pg

If the credentials are wrong, PerformanceGuard returns 401 Unauthorized.

Endpoints that return data for a period take an interval query parameter. The value has up to three parts, separated by |:

<period>|<end>|<offset>

Part Required Description
period Yes The length of the interval. See the values in the next table.
end No The end of the interval, as an ISO 8601 date and time with a time zone, or a UTC timestamp in milliseconds. If you leave it out or leave it empty, the interval ends now.
offset No A time zone offset in minutes that’s used when PerformanceGuard calculates calendar periods and the current time.

These are the values you can use for period:

Value Meaning
A number, for example 3600000 The number of milliseconds before the end. 3600000 is one hour.
0 Two delivery intervals before the end.
XD followed by a number, for example XD30 The number of days before the end.
CH, CD, CW, CM, CQ, CY The current hour, day, week, month, quarter, or year, from its start until the end.
PH, PD, PW, PM, PQ, PY The previous full hour, day, week, month, quarter, or year.

Examples:

  • interval=86400000: the last 24 hours.
  • interval=XD7: the last seven days.
  • interval=PD: yesterday.
  • interval=86400000|2026-01-31T00:00:00Z: the 24 hours before midnight UTC on 31 January 2026.

URL-encode the | character as %7C when you build the address yourself. To check how PerformanceGuard reads an interval value, try it on the /api/internal/interval endpoint in Swagger.

Some endpoints can also return an Excel workbook. In Swagger, those endpoints list application/vnd.openxmlformats-officedocument.spreadsheetml.sheet as a response type. To get the workbook, send that value in the Accept header of the request.