Management API Overview
PolicyServer provides a REST-based API to manage PolicyServer resources including policies, role assignments, permission assignments and tenants. The PolicyServer UI relies on this Management API to supply its features.
Integration Workflow
You can integrate with PolicyServer with your own applications using the Management API.
The PolicyServer Management API is available at your host path
with the relative path /management
. From this root path,
the Management API will return the available PolicyServer resources
based on your license and configuration of the Management API host.
Typically the integration workflow follows these steps:
Request an access token from the PolicyServer token endpoint
Call the Management API passing the access token and information required for the endpoint being called
Integration
You can use the Management API to create custom application integrations with PolicyServer, for example:
Extending your existing user management applications to manage policies for users and store this information with PolicyServer
Pre-loading the PolicyServer database with tenants, roles, permissions or policy hierarchies rather than manually creating these items via the PolicyServer UI
The Management API requires a valid token issued by the PolicyServer token server (i.e. authority or issuer). Any custom integrations must request a token prior to calling the API. See the PolicyServer Samples for an example of this.
For more information see Management API Endpoints
HTTP Responses
The following HTTP responses should be considered when making requests to any of the PolicyServer APIs.
Status |
Description |
---|---|
200 |
The request was successful. Where applicable the documentation will provide payload details. |
201 |
The resource was created. A location header is returned for the new resource. |
400 |
A bad request was submitted, possibly incorrect parameters or payload. |
403 |
The request was forbidden, likely due to an invalid token. |
404 |
The resource was not found or does not exist. Possibly a bad request path. |
500 |
An unexpected server error occurred. The logs should produce the reason for this, and we’d love to fix it. |
Bad Request (HTTP Status Code 400) Error Payload
When a request is made to PolicyServer and the response status code is 400 Bad Request
, then a standard error payload is returned.
The errors contained in the payload are expected to be safe for end users to view (since they might contain validation error messages).
Response
Data returned:
{
"errors": ["The Policy name is required."]
}
Versioning
The PolicyServer APIs are versioned.
By default when making requests to any endpoint the latest version of the API will be used.
To request a specific version of the API, a version=<number>
query parameter should be passed to the endpoint being requested.
To determine the current version of the API, make a HTTP GET
request to the /management
endpoint and inspect the returned version
value in the response data
.
For example:
{
"data": {
"version": 1
}
}