Policies API
This API allows managing policies in the system. It provides endpoints to create, read, update, and delete policies, as well as to perform searches and queries on them.
The Policy Object
The Policy object represents a policy in the system.
Attributes
| Attribute | Description | Type |
|---|---|---|
| id | Unique identifier of the policy | String |
| label | Label or name of the policy | String |
| language | Language of the policy | String |
| key | Unique key of the policy | String |
| version | Current version of the policy | Integer |
| shortText | Short summary of the policy | String |
| longText | Full text of the policy | String |
| policyUrl | URL of the policy | String |
| versionHistory | Version history of the policy | Array of Object |
| createdAt | Creation date of the policy | String (ISO 8601) |
| updatedAt | Last update date of the policy | String (ISO 8601) |
| tags | Tags associated with the policy | Array of String |
Endpoints
Create a New Policy
Creates a new policy in the system.
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
| key | Unique key of the policy | String | Yes |
| shortText | Short summary of the policy | String | No |
| longText | Full text of the policy | String | No |
| policyUrl | URL of the policy | String | No |
| tags | Tags associated with the policy | Array of String | No |
Request Example:
Successful Response:
Note: The
longTextfield can contain templates as values.
Update a Policy
Updates an existing policy.
Path Parameters:
| Parameter | Description |
|---|---|
| policy_id | ID of the policy to update |
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
| shortText | New short summary of the policy | String | No |
| longText | New full text of the policy | String | No |
| policyUrl | New URL of the policy | String | No |
| tags | New tags of the policy | Array of String | No |
Request Example:
Successful Response:
The response will be the updated Policy object.
Get a Policy
Retrieves the information of a specific policy.
Path Parameters:
| Parameter | Description |
|---|---|
| policy_id | ID of the policy to retrieve |
Successful Response:
The response will be the complete Policy object.
Delete a Policy
Deletes a policy from the system.
Path Parameters:
| Parameter | Description |
|---|---|
| policy_id | ID of the policy to delete |
Successful Response:
Status code 204 (No Content) if the deletion was successful.
List Policies
Retrieves a paginated list of policies with filtering and sorting options.
Query Parameters:
| Parameter | Description | Type |
|---|---|---|
| search | Text to search within policies | String |
| key | Filter by policy key | String |
| page | Page number (default: 1) | Integer |
| per-page | Items per page (default: 10) | Integer |
| sort-by | Field to sort by | String |
| sort-direction | Sorting direction (asc or desc) | String |
Successful Response:
The response will be a paginated list of Policy objects.
Fill a Policy as a Template
Takes a policy and replaces placeholders with the provided values
Path Parameters:
| Parameter | Description |
|---|---|
| policy_id | ID of the policy to fill |
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
| fields | Dictionary with field names and their values | JSON | Yes |
Request Example
Error Handling
The API may return the following error codes:
| Code | Description |
|---|---|
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
Errors will include a descriptive message in the response body.