Evaluates policy
post
/oaa-policy/policy/v1/expression
Validate policy expression present in the request and return success if the expression can be evaluated true or false. If the expression cannot be evaluated due to syntax or compilation error, it will return error.
Request
There are no request parameters for this operation.
Supported Media Types
- application/xml
- application/json
Root Schema : schema
Type:
object
Policy expression object
Show Source
-
expression: string
Expression to be validated by the default policy engine configured in policy deployment.
Root Schema : schema
Type:
object
Policy expression object
Show Source
-
expression: string
Expression to be validated by the default policy engine configured in policy deployment.
Response
Supported Media Types
- application/xml
- application/json
201 Response
Policy expression validation response.
Root Schema : PolicyExpressionResponse
Type:
object
Policy expression object
Show Source
-
expression: string
Expression that was validated. Same as the request object expression.
-
message: string
In case of error, the message will point the error in the expression present in the request.
-
status: string
Success or error based on the expression provided in the result.
401 Response
Unauthorized
405 Response
Invalid input
Root Schema : PolicyExpressionResponse
Type:
object
Policy expression object
Show Source
-
expression: string
Expression that was validated. Same as the request object expression.
-
message: string
In case of error, the message will point the error in the expression present in the request.
-
status: string
Success or error based on the expression provided in the result.
500 Response
Internal server error
503 Response
Service Unavailable
Examples
The following example shows a sample request and response for validating policy expression present in the request and return success.
cURL Command to Validate a Policy Expression in JSON Format
curl --location --request POST '<PolicyUrl>/oaa-policy/policy/v1/expression' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic <Base64Encoded(<username>:<password>)>' \ --data '{ "expression": "context.ip.inRange('\''127_ddd32e7186d66b2cb96cc4608ded0bb7d6ae4a48b1fc1894c69e715cf262e7ad'\'')" }'
Sample Response in JSON Format
{ "expression": "context.ip.inRange('127_ddd32e7186d66b2cb96cc4608ded0bb7d6ae4a48b1fc1894c69e715cf262e7ad')", "status": "SUCCESS" }
cURL Command to Validate a Policy Expression in XML Format
curl --location --request POST '<PolicyUrl>/oaa-policy/policy/v1/expression' \ --header 'Content-Type: application/xml' \ --header 'Accept: application/xml' \ --header 'Authorization: Basic <Base64Encoded(<username>:<password>)>' \ --data '<?xml version="1.0" encoding="UTF-8" ?> <expression>context.ip.inRange("127_ddd32e7186d66b2cb96cc4608ded0bb7d6ae4a48b1fc1894c69e715cf262e7ad")</expression> '
Sample Response in XML Format
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <PolicyExpressionResponse> <expression>context.ip.inRange("127_ddd32e7186d66b2cb96cc4608ded0bb7d6ae4a48b1fc1894c69e715cf262e7ad")</expression> <status>SUCCESS</status> </PolicyExpressionResponse>