- REST API for Oracle Web Services ManagerREST API for Oracle Web Services Manager
- Use Cases
- Create and Manage Policy Sets
- Attach and Manage Policy References
Attach and Manage Policy References
You can use the Policy Set REST APIs to attach and manage policy references.
http(s)://host:port/wsm-pmrest/v2/policyset/{name}/policyreference
The following use case shows you how to:
-
Attach a policy reference
-
Modify the a policy reference
-
View the policy reference
-
Delete the policy reference
To manage the policy set:
- Specify the headers on the cURL command line:
-H Accept:application/json
- Attach the
oracle/wss_username_token_service_policy
and theoracle/log_policy
policies to themyPolicySet1
policy set by running the following command:curl -i -X POST -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/policyset/{name}/policyreference
Example
curl -i -X POST -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/policyset/myPolicySet1/policyreference
The following shows an example of the request body.
[ { "uri": "oracle/log_policy", "status": "enabled", "category": "management" }, { "uri": "oracle/wss_username_token_service_policy", "status": "enabled", "category": "security" } ]
The following shows an example of the response indicating the request succeeded.
{ "STATUSCODE": "20011", "MESSAGE": "Policies [oracle/log_policy, oracle/wss_username_token_service_policy] are successfully attached." }
- Enable the
oracle/log_policy
policy reference for themyPolicySet1
policy set by running the following command:curl -i -X PATCH -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/policyset/{name}/policyreference/{policyuri}
Example
curl -i -X PATCH -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/policyset/myPolicySet1/policyreference/oracle%2Flog_policy
Note:
In the URL, the "/
" character in the name of a policy is encoded with "2%F
"See Update a PolicyReference by its URI.
The following shows an example of the request body.
{ "uri": "log_policy", "status": "enabled" }
The following shows an example of the response indicating the request succeeded.
{ "STATUSCODE": "20002", "MESSAGE": "Policies oracle/log_policy" are successfully updated." }
- View all the attached policies for the policy set
myPolicySet1
by running the following command:curl -i -X GET -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/policyset/{name}/policyreference
Example
curl -i -X GET -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/policyset/myPolicySet1/policyreference
The following shows an example of the response body:
[ { "uri": "wss_username_token_service_policy", "status": "enabled" }, { "uri": "log_policy", "status": "disabled" } ]
- Optionally, detach a policy reference based on the URI from
myPolicySet1
by running the following command:curl -i -X DELETE -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/policyset/{name}/policyreference/{policyuri}
Example
curl -i -X DELETE -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/policyset/myPolicySet1/policyreference/oracle%2Flog_policy
Note:
In the URL, the "/
" character in the name of a policy is encoded with "2%F
"See Delete a PolicyReference by its URI.
The following shows an example of the response indicating the request succeeded.
{ "STATUSCODE": "20014", "MESSAGE": "Policies oracle/log_policy are successfully detached." }
- Optionally, detach all the policies from the policy set
myPolicySet1
by running the following command:curl -i -X DELETE -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/policyset/{name}/policyreference
Example
curl -i -X DELETE -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/policyset/myPolicySet1/policyreference
See Delete PolicyReference(s).
The following shows an example of the response indicating the request succeeded.
{ "STATUSCODE": "20014", "MESSAGE": "Policies are successfully detached." }