The policies API provides functionality that allows a administrator to add, delete or update policies
Lists all the policies configured in the Aspire, this endpoint need the at least the OPERATOR role to be executed.
GET /aspire/_api/policies
Pagination query string parameters
Sorting query string parameters
Lists policies configured in the Aspire, filtered by a specified criteria, this endpoint need the at least the OPERATOR role to be executed.
Response
{ "count": { "totalItems": 3 }, "policy": [ { "id": "10653921-1b27-40b5-9d7a-f54ef1e3ad01", "type": "throttle", "description": "throttleDesc", "period": "minute", "value": 5 }, { "id": "14822610-a387-44cf-a5ed-3e05618efb57", "type": "throttle", "description": "throttleDesc", "period": "day", "value": 333 }, { "id": "e10af522-5830-4105-9886-3385499202ba", "type": "route", "description": "routim to cz", "routeTo": "CZZZ" } ] }
Status: 200
Gets information about a single policy configured in Aspire, this endpoint need the at least the OPERATOR role to be executed.
GET /aspire/_api/policies/:id
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | Required | The id of the policy to return |
Response
{ "id": "10653921-1b27-40b5-9d7a-f54ef1e3ad01", "type": "throttle", "description": "throttleDesc", "period": "minute", "value": 5 }
Status: 200, 404
Adds policies to Aspire, this endpoint need the at least the ADMINISTRATOR role to be executed.
POST /aspire/_api/policies
Body Parameters
Name | Type | Required | Description |
---|---|---|---|
type | string | Required | The type of policy to add
|
description | string | Required | An optional description of the policy |
Other parameters passed in the request body will depend on the type of policy being created:
Throttle type:
Name | Type | Required | Description |
---|---|---|---|
period | string | Required | Time unit of the throttling policy - second, minute, hour, day |
value | int | Required | Number of documents per time unit for the throttling policy |
Route type:
Name | Type | Required | Description |
---|---|---|---|
routeTo | string | Required | A route to tag |
DeleteIncremental type:
Name | Type | Requried | Description |
---|---|---|---|
deletesPolicy | DeletesPolicy | Required |
|
deleteCheckAfterErrors | enum DeleteCheckAfterErrors | Required for a variant IMMEDIATE | Checks if "delete" candidates still exist after an incremental when they are part of scan error.
|
value | int | Required for a variant AFTER_DAYS, AFTER_INCREMENTALS | Number of days or iterations. Valid value is also -1, that means that sends the deletes immediately since the last time the URLs were accessed. |
Example
POST /aspire_api/policies [{ "type": "throttle", "description": "Europe Net Appliance throttle", "period": "minute", "value": "100" }, { "type": "route", "description": "German servers", "routeTo": "US" }, { "type": "deleteIncremental", "description": "Days before delete", "deletesPolicy": "AFTER_DAYS", "value": "1" }, { "type": "deleteIncremental", "description": "Iterations before delete", "deletesPolicy": "AFTER_INCREMENTALS", "value": "2" }, { "type": "deleteIncremental", "description": "default immediate policy", "deletesPolicy": "IMMEDIATE", "deleteCheckAfterErrors": "ALWAYS" }, ]
Response
{ "policy": [{ "id": "AAABcID5GBc=", "type": "throttle" "description": "Europe Net Appliance throttle", "period": "minute", "value": "100" }, { "id": "AAABcID5GBd=", "type": "route" "description": "All servers", "routeTo": "US" }, { "id": "AAABcID5GBe=", "type": "deleteIncremental", "description": "Days before delete", "deletesPolicy": "AFTER_DAYS", "value": "1" }, { "id": "AAABcID5GBf=", "type": "deleteIncremental", "description": "Iterations before delete", "deletesPolicy": "AFTER_INCREMENTALS", "value": "2" }, { "id": "AAABcID5GBg=", "description": "default immediate policy", "deletesPolicy": "IMMEDIATE", "deleteCheckAfterErrors": "ALWAYS" } ] }
See Response Body for details regarding the response body returned where multiple items are affected with some (or all) returning errors
Status: 201, 406
Update policies in Aspire, this endpoint need the at least the ADMINISTRATOR role to be executed.
PUT /aspire/_api/policies/:id
PUT /aspire/_api/policies
Body Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | Required | The identifier of the policy to update |
description | string | x | A description |
period | string | x | Time unit of the throttling policy - second, minute, hour, day |
value | int | x | Number of documents per time unit for the throttling policy, number of days or iterations for delete Incremental policy |
routeTo | string | x | A route to tag |
deleteCheckAfterErrors | enum DeleteCheckAfterErrors | x | Checks if "delete" candidates still exist after an incremental when they are part of scan error. (ALWAYS/NEVER) |
x - at least one field must be present
Example
PUT /aspire_api/policies { "AAABcID5GBc=": { "id": "AAABcID5GBc=", "description": "Europe Net Appliance", "period": "minute", "value": "100" }, "AAABcID5GBd=": { "id": "AAABcID5GBd=", "description": "German server", "routeTo": "US" }, "AAABcID5GBe=": { "id": "AAABcID5GBe=", "description": "default immediate policy", "deleteCheckAfterErrors": "NEVER" }, "AAABcID5GBf=": { "id": "AAABcID5GBf=", "description": "Iterations before delete", "value": "3" }
Response
{"policy":[{"updated":true,"id":"AAABcID5GBc="},{"updated":true,"id":"AAABcID5GBd="},{"updated":true,"id":"AAABcID5GBe="},{"updated":true,"id":"AAABcID5GBf="}]}
Status: 200, 404, 406
Update policies configured in the Aspire, filtered by a specified criteria, this endpoint need the at least the ADMINISTRATOR role to be executed.
PUT /aspire/_api/policies/updateAll
{ "update" : { "description" : "DESCRIPTION" "period" : "PERIOD" "value" : "VALUE" "routeTo" : "ROUTE_TO" "deleteCheckAfterErrors" : "NEVER" } }
Response
{ "message": "update result response message" }
Status: 200, 406
Delete one or more policies from Aspire, this endpoint need the at least the ADMINISTRATOR role to be executed.
DELETE /aspire/_api/policies/:id
DELETE /aspire/_api/policies
POST /aspire/_api/policies/delete
Path Parameters and Query parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | Required | The identifier(s) of the policy (s) to delete |
Body Parameter
Name | Type | Required | Description |
---|---|---|---|
ids | string | Required | The identifier(s) of the policy(s) to delete |
Examples
DELETE /aspire/_api/policies/AAABcID5GBc DELETE /aspire/_api/policies?id=AAABcID5GBc&id=AAABcID5GBd POST /aspire/_api/policies/delete { "ids":["AAABcID5GBc","AAABcID5GBd"] }
Response
{ "message": "delete result response message" }
Status: 200, 404, 406
Delete multiple policies from Aspire, filtered by a specified criteria, this endpoint need the at least the ADMINISTRATOR role to be executed.
POST /aspire/_api/policies/deleteAll
Response
{ "message": "delete result response message" }
Status: 200
Export one or more policy from Aspire, this endpoint needs at least the OPERATOR role to be executed.
GET /aspire/_api/policies/export
GET /aspire/_api/policies/export/:id
POST /aspire/_api/policies/exportAll
Every configuration item has the option to export from the UI, using the single menu or by the bulk actions:
Something important that you need to know is that when you export a config item that depends on another, the export will contain also all the dependencies.
Take into consideration that components with resources loaded into elastic, will be exported, but the resource itself will not, so you will need to reupload the resource and go and select your resource in the component again.
Path Parameters and Query parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | Required | The identifier(s) of the policy(ies) to export |
Body Parameter
Name | Type | Required | Description |
---|---|---|---|
ids | string | Required | The identifier(s) of the policy(ies) to export |
Examples
GET /aspire/_api/policies/export/AAABcID5GBc DELETE /aspire/_api/policies/export?id=AAABcID5GBc&id=AAABcID5GBd POST /aspire/_api/policies/export { "ids":["AAABcID5GBc","AAABcID5GBd"] }
Response
{ "export": { "policies": { "policy": [ { "id": "<policy_id>", "type": "deleteIncremental", "description": "pD", "deletesPolicy": "IMMEDIATE", "deleteCheckAfterErrors": "ALWAYS" }, ... ] } } }
Status: 200, 404, 406
Export multiple policies from Aspire, filtered by a specified criteria, this endpoint needs at least the OPERATOR role to be executed.
Connector filter:
{ "filter" : { "ids" : ["ID1", "ID2", "ID3", ...], "type" : "TYPE", "description" : "DESCRIPTION", "artifact" : "ARTIFACT" } }