Get Policy
get
/iam/governance/selfservice/api/v1/policies
Returns all the access,username and approval policies of the specified type. Additional filters can be added to get more specifics. For example, to get all the access policies that have the name starting with "A" and a role Employee (with roleID=1234)in it the URI will be /policies?policyType=accessPolicy&roleid=1234&q=name sw "A"
Request
Supported Media Types
- application/json
Query Parameters
-
fields(optional): string
Attributes to be returned in the result. Policy ID is mandatory in attrbutes to return list. Comma-separated attributes are accepted.
-
policyType: string
Enables to get the policies which are of the type specified in the policyType query parameter. The supported values are "usernamePolicy, accessPolicy and approvalPolicy".
-
q: string
The filter enables to get a subset of the policies of the type specified in the "policyType" query parameter. SCIM filter is accepted. There should not be any spaces for attribute value. If you want to pass space in between attribute values then replace it with "::".
-
roleid(optional): string
Returns the access policies which are related to the specified role. The role ID query parameter is valid when the "policyType" is "accessPolicy".
Response
Supported Media Types
- application/json
200 Response
Successful
Headers
-
ResponseTime: string
Captures the time in milliseconds taken for processing the request.
401 Response
Unauthorized
404 Response
Resource not found
500 Response
Internal Server Error
Default Response
Unexpected error
Examples
This example retrieves all the policies of type passwordPolicy. The information shown here is against a pseudo system and serves as a prototype.
cURL Example
curl -H "Content-Type: application/json" -X GET -u username:password https://pseudo.com/iam/governance/selfservice/api/v1/policies?policyType=passwordpolicy
Example of GET Response Body
The following example shows the contents of the response body in JSON format.
{ "links": [ { "rel": "self", "href": "http://pseudo.com/iam/governance/selfservice/api/v1/policies?policyType=passwordpolicy&offset=1&limit=10" }, { "rel": "first", "href": "http://pseudo.com/iam/governance/selfservice/api/v1/policies?policyType=passwordpolicy&offset=1&limit=10" } ], "count": 1, "hasMore": false, "totalResult": -1, "policy": [ { "links": [ { "rel": "self", "href": "http://pseudo.com/iam/governance/selfservice/api/v1/policies/42?policyType=passwordPolicy" } ], "id": "42", "pwr_name": "Polict_Test_3", "pwr_desc": "Polict_Test_3", "rules": [ "Password must be at least 8 character(s) long.", "Password cannot be changed for 10 days after the last password change.", "Password must not be one of 2 previous passwords." ] } ] }