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
Request Body - application/xml ()
Root Schema : schema
Type: object
Policy expression object
Show Source
  • Expression to be validated by the default policy engine configured in policy deployment.
Request Body - application/json ()
Root Schema : schema
Type: object
Policy expression object
Show Source
  • Expression to be validated by the default policy engine configured in policy deployment.
Back to Top

Response

Supported Media Types

201 Response

Policy expression validation response.
Body ()
Root Schema : PolicyExpressionResponse
Type: object
Policy expression object
Show Source
  • Expression that was validated. Same as the request object expression.
  • In case of error, the message will point the error in the expression present in the request.
  • Success or error based on the expression provided in the result.

401 Response

Unauthorized

405 Response

Invalid input
Body ()
Root Schema : PolicyExpressionResponse
Type: object
Policy expression object
Show Source
  • Expression that was validated. Same as the request object expression.
  • In case of error, the message will point the error in the expression present in the request.
  • Success or error based on the expression provided in the result.

500 Response

Internal server error

503 Response

Service Unavailable
Back to Top

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>
Back to Top