Get Policies
This endpoint returns a list of policies in a particular workspace. This API is available to API keys with app_policy_management
capability.
GET /openapi/v1/applications/{application_id}/policies
Parameters: The request URL contains the following parameters
Name |
Type |
Description |
---|---|---|
version |
string |
Indicates the version of the workspace from which to get the policies. |
consumer_filter_id |
string |
(optional) Filters the output by the consumer filter id. |
provider_filter_id |
string |
(optional) Filters the output by the consumer filter id. |
Policy IDs can change from version to version. To obtain the list of policies from a published version, the version number should be prefixed with a 'p'. For example, to fetch all the policies in published version 3 we can perform a request such as:
GET /openapi/v1/applications/{application_id}/policies?version=p3
Returns an object of all policies in this particular workspace as shown below
{
absolute_policies: [ ... ],
default_policies: [ ... ],
catch_all_action:
}
Sample Python code
application_id = '5f88c996755f023f3bafe163'
restclient.get('/applications/%s/policies' % application_id, params={'version': '1'})
Get Default Policies
This endpoint returns a list of Default policies for a given workspace. This API is available to API keys with app_policy_management
capability.
GET /openapi/v1/applications/{application_id}/default_policies
Parameters:
Name |
Type |
Description |
---|---|---|
id |
string |
Unique identifier for the policy. |
version |
string |
Indicates the version of the workspace for which to get the policies. |
limit |
integer |
Limits the number of policies per request. |
offset |
integer |
(optional) Offset number received from previous response, should always be used along with |
consumer_filter_id |
string |
(optional) Filters the output by the consumer filter id. |
provider_filter_id |
string |
(optional) Filters the output by the provider filter id. |
Returns a list of default policies for the provided version of this workspace. The response contains the requested number of polices and an offset
, to get the next set policies use this offset
in the subsequent requests. Absence of an offset
in the response indicates that all the policies are already retrieved.
Sample Python code
application_id = '5f88c996755f023f3bafe163'
restclient.get('/applications/%s/default_policies' % application_id, params={'version': '1', 'limit': 3, 'offset': 3})
Sample response
{
"results": [
PolicyObject4,
PolicyObject5,
PolicyObject6
],
"offset": 6
}
Get Absolute Policies
This endpoint returns a list of Absolute policies in a given workspace. This API is available to API keys with app_policy_management
capability.
GET /openapi/v1/applications/{application_id}/absolute_policies
Parameters:
Name |
Type |
Description |
---|---|---|
version |
string |
Indicates the version of the workspace from which to get the policies. |
limit |
integer |
Limits the number of policies per request. |
offset |
integer |
(optional) Offset number received from previous response, should always be used along with |
consumer_filter_id |
string |
(optional) Filters the output by the consumer filter id. |
provider_filter_id |
string |
(optional) Filters the output by the provider filter id. |
Returns a list of absolute policies in the provided version of this workspace. The response contains the requested number of polices and an offset
, to get the next set policies use this offset
in the subsequent requests. Absence of an offset
in the response indicates that all the policies are already retrieved.
Sample Python code
application_id = '5f88c996755f023f3bafe163'
restclient.get('/applications/%s/absolute_policies' % application_id, params={'version': '1', 'limit': 3})
Sample response
{
"results": [
PolicyObject1,
PolicyObject2,
PolicyObject3
],
"offset": 3
}
Get Catch All Policies
This endpoint returns a Catch All policy for a given workspace. This API is available to API keys with app_policy_management
capability.
GET /openapi/v1/applications/{application_id}/catch_all
Parameters:
Name |
Type |
Description |
---|---|---|
version |
string |
Indicates the version of the workspace from which to get the policies. |
Returns a single policy object representing the catch all policy of the given version of the workspace.
Sample Python code
application_id = '5f88c996755f023f3bafe163'
restclient.get('/applications/%s/catch_all' % application_id, params={'version': '1'})