You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »


The policies API provides functionality that allows a administrator to add, delete or update policies

Get all policies

Lists all the policies configured in the Aspire

GET /aspire/_api/policies


Query String Parameters

NameTypeRequiredDescription
fromintegerOptionalIndicates the initial page to be retrieved
sizeintegerOptionalSpecifies the size of results page
sortBystringOptionalField by which results are sorted
sortModestringOptional

Sort mode

  • "asc" for ascending sort,
  • "desc" for descending sort


Response

{
  "policy": [{
    "id": "AAABcID5GBc=",
    "type": "throttle",
	"description": "Europe Net Appliance throttle",
    "timeUnit": "m",
	"timeUnitRate": "1",
	"numberOfDocuments": "100"
  },
  {
    "id": "AAABcIueWUc=",
    "type": "route",
	"description": "All servers",
    "tags": ["US","UK","DEU"]
  }]
}


Status

Response codeDescription
200Success




Get all policies, filtered

Lists policies configured in the Aspire, filtered by a specified criteria

POST /aspire/_api/policies/getAll


Query String Parameters

NameTypeRequiredDescription
fromintegerOptionalIndicates the initial page to be retrieved
sizeintegerOptionalSpecifies the size of results page
sortBystringOptionalField by which results are sorted
sortModestringOptional

Sort mode

  • "asc" for ascending sort,
  • "desc" for descending sort


Body Parameters

NameTypeRequiredDescription
filterJSONRequiredFilters retrieved policies. Check the filter definition here


Response

{  
  "policy": [{
    "id": "AAABcID5GBc=",
    "type": "throttle",
	"description": "Europe Net Appliance throttle",
    "timeUnit": "m",
	"timeUnitRate": "1",
	"numberOfDocuments": "100"
  },
  {
    "id": "AAABcIueWUc=",
    "type": "route",
	"description": "All servers",
    "tags": ["US","UK","DEU"]
  }]
}


Status

Response codeDescription
200Success




Get single policy

Gets information about a single policy configured in Aspire

GET /aspire/_api/policies/:id


Query String Parameters

NameTypeRequiredDescription
idstringRequiredThe id of the policy to return


Response

{
  "policy": {
    "id": "AAABcID5GBc=",
    "type": "throttle",
	"description": "Europe Net Appliance throttle",
    "timeUnit": "m",
	"timeUnitRate": "1",
	"numberOfDocuments": "100"
 }
}


Status

Response codeDescription
200Success




Add policies

Adds policies to Aspire

POST /aspire/_api/policies


Request Body Parameters

NameTypeRequiredDescription
typestringRequired

The type of policy to add

  • "throttle"
  • "route"
descriptionstringOptionalAn optional description of the policy


Other parameters passed in the request body will depend on the type of policy being created:


Throttle type:

NameTypeRequiredDescription
timeUnitstringRequiredTime unit of the throttling policy
timeUnitRateintRequiredThe rate at which each time unit is throttled
numberOfDocumentsintRequiredNumber of documents per time unit for the throttling policy


Route type:

NameTypeRequiredDescription
tagsarray of stringsRequiredTags for the routing policy


Example

POST /aspire_api/policies
[{
  "type": "throttle",
  "description": "Europe Net Appliance throttle",
  "timeUnit": "s",
  "timeUnitRate": "10",
  "numberOfDocuments": "10"
},
{
  "type": "route",
  "description": "German servers",
  "tags": ["US","UK","DEU"]
}]


Response

{
  "policy": [{
    "id": "AAABcID5GBc=",
    "type": "throttle"
    "description": "Europe Net Appliance throttle",
    "timeUnit": "s",
    "timeUnitRate": "10",
    "numberOfDocuments": "10"
   },
   {
    "id": "AAABcID5GBd=",
    "type": "route"
    "description": "All servers",
    "tags": ["US","UK","DEU"]
   }]
}


Status

Response codeDescription
201Created
406Not acceptable - there was an issue validating the input




Update policies

Update policies in Aspire.

PUT /aspire_api/policies


Body Parameters

NameTypeRequiredDescription
idstringRequiredThe identifier of the policy to update
typestringOptionalThe type of policy
descriptionstringOptionalAn optional description of the seed

Other parameters passed in the request body will depend on the type of policy being created - see Add a Policy above

Example

PUT /aspire_api/policies
{
  "AAABcID5GBc=": {
    "id": "AAABcID5GBc=",
    "type": "throttle"
    "description": "Europe Net Appliance",
	"timeUnit": "s",
    "timeUnitRate": "1",
    "numberOfDocuments": "10"
  },
  "AAABcID5GBd=": {
    "id": "AAABcID5GBd=",
    "type": "route"
    "description": "German server",
    "tags": ["DEU"]
  }
}


Response

{
  "policy": [{
    "id": "AAABcID5GBc=",
    "type": "throttle"
    "description": "Europe Net Appliance",
	"timeUnit": "s",
	"timeUnitRate": "1",
    "numberOfDocuments": "10"
   },
   {
    "id": "AAABcID5GBd=",
    "type": "route"
    "description": "German server",
    "tags": ["DEU"]
  }]
}


Status

Response codeDescription
200Success
404Not found - a given seed identifier was not found
406Not acceptable - there was an issue validating the input




Delete multiple policies, filtered

Delete multiple policies from Aspire, filtered by a specified criteria

POST /aspire/_api/policies/deleteAll


Body Parameters

NameTypeRequiredDescription
filterJSONRequiredFilters retrieved policies. Check the filter definition here


Response

{
  "message": "optional response message"
}

See Response Body for details regrading the response body returned where multiple items are affected with some (or all) returning errors

Status

Response codeDescription
200Success
404Not found - a given credential identifier was not found
406Not acceptable - there was an issue validating the input




Delete policy

Delete a single policy from Aspire.

DELETE /aspire_api/policies/:id


Query String Parameters

NameTypeRequiredDescription
idstringRequiredThe identifier of the policy to delete


Example

DELETE /aspire_api/policies/AAABcID5GBc%3D

Delete multiple policies


Response

{
  "message": "optional response message"
}

Status

Response codeDescription
200Success
404Not found - a given seed identifier was not found
406Not acceptable - there was an issue validating the input




Filters

 Some endpoint queries require a filter. A filter is basically a JSON object with the following format:

Credentials filter:

  "filter" : {
    "ids" : ["id1", "id2", "id3"],
    "type" : "TYPE",
    "description" : "DESCRIPTION"
  }
When using delete endpoints, ids in the filter are mandatory.
  • No labels