BREAGEN Logo
User Management Service

Policy Rule Management

The Policy Rule Management service provides functionality to manage rules associated with policies, including creation, retrieval, updating, and deletion of policy rules.

Policy Rule Operations

Get Policy Rule by IDs GET /api/v1/policy-rule/

Resource URL/api/v1/policy-rule/
Response FormatJSON
Requires AuthenticationYes
Rate LimitedYes
HTTPSYes

Query Parameters

ParameterTypeRequiredDescription
policyIdintegerYesID of the policy
attributeIdintegerYesID of the attribute

Example Request

curl -X 'GET' \
'https://um.braegen.ai/api/v1/policy-rule/?policyId=1&attributeId=1' \
-H 'accept: */*' \
-H 'Authorization: Bearer {token}'

Example Response

{
	"success": true,
	"status": "200 OK",
	"data": {
		"id": 1,
		"policy": {
			"id": 1,
			"policyName": "AdminAccess"
		},
		"attribute": {
			"id": 1,
			"attributeName": "role"
		},
		"operator": "EQUALS",
		"value": "admin"
	}
}

Update Policy Rule PUT /api/v1/policy-rule/

Resource URL/api/v1/policy-rule/
Response FormatJSON
Requires AuthenticationYes
Rate LimitedYes
HTTPSYes

Request Body

{
	"policyId": 1,
	"attributeId": 1,
	"operator": "EQUALS",
	"value": "supervisor"
}

Example Request

curl -X 'PUT' \
'https://um.braegen.ai/api/v1/policy-rule/' \
-H 'accept: */*' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \
-d '{
    "policyId": 1,
    "attributeId": 1,
    "operator": "EQUALS",
    "value": "supervisor"
}'

Example Response

{
	"success": true,
	"status": "200 OK",
	"message": "Policy rule updated successfully",
	"data": {
		"id": 1,
		"policy": {
			"id": 1,
			"policyName": "AdminAccess"
		},
		"attribute": {
			"id": 1,
			"attributeName": "role"
		},
		"operator": "EQUALS",
		"value": "supervisor"
	}
}

Delete Policy Rule DELETE /api/v1/policy-rule/

Resource URL/api/v1/policy-rule/
Response FormatJSON
Requires AuthenticationYes
Rate LimitedYes
HTTPSYes

Query Parameters

ParameterTypeRequiredDescription
policyIdintegerYesID of the policy
attributeIdintegerYesID of the attribute to delete

Example Request

curl -X 'DELETE' \
'https://um.braegen.ai/api/v1/policy-rule/?policyId=1&attributeId=1' \
-H 'accept: */*' \
-H 'Authorization: Bearer {token}'

Example Response

{
	"success": true,
	"status": "200 OK",
	"message": "Policy rule deleted successfully",
	"data": {
		"deleted_policy_rule": {
			"policyId": 1,
			"attributeId": 1
		}
	}
}

Get All Policy Rules GET /api/v1/policy-rule

Resource URL/api/v1/policy-rule
Response FormatJSON
Requires AuthenticationYes
Rate LimitedYes
HTTPSYes

Example Request

curl -X 'GET' \
'https://um.braegen.ai/api/v1/policy-rule' \
-H 'accept: */*' \
-H 'Authorization: Bearer {token}'

Example Response

{
	"success": true,
	"status": "200 OK",
	"data": [
		{
			"id": 1,
			"policy": {
				"id": 1,
				"policyName": "AdminAccess"
			},
			"attribute": {
				"id": 1,
				"attributeName": "role"
			},
			"operator": "EQUALS",
			"value": "admin"
		},
		{
			"id": 2,
			"policy": {
				"id": 2,
				"policyName": "UserAccess"
			},
			"attribute": {
				"id": 1,
				"attributeName": "role"
			},
			"operator": "EQUALS",
			"value": "user"
		}
	]
}

Create Policy Rule POST /api/v1/policy-rule

Resource URL/api/v1/policy-rule
Response FormatJSON
Requires AuthenticationYes
Rate LimitedYes
HTTPSYes

Request Body

{
	"policyId": 1,
	"attributeId": 1,
	"operator": "EQUALS",
	"value": "admin"
}

Example Request

curl -X 'POST' \
'https://um.braegen.ai/api/v1/policy-rule' \
-H 'accept: */*' \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \
-d '{
    "policyId": 1,
    "attributeId": 1,
    "operator": "EQUALS",
    "value": "admin"
}'

Example Response

{
	"success": true,
	"status": "200 OK",
	"message": "Policy rule created successfully",
	"data": {
		"id": 3,
		"policy": {
			"id": 1,
			"policyName": "AdminAccess"
		},
		"attribute": {
			"id": 1,
			"attributeName": "role"
		},
		"operator": "EQUALS",
		"value": "admin"
	}
}

Supported Operators

OperatorDescription
EQUALSExact match comparison
NOT_EQUALSNegative match comparison
CONTAINSString contains comparison
STARTS_WITHString starts with comparison
ENDS_WITHString ends with comparison
GREATER_THANNumeric greater than comparison
LESS_THANNumeric less than comparison
GREATER_THAN_EQUALSNumeric greater than or equals comparison
LESS_THAN_EQUALSNumeric less than or equals comparison

HTTP Response Codes

HTTP CodeMessage
200Success
204No Content
400Bad Request
401Unauthorized
403Invalid Input
404Invalid or not found type

All endpoints require proper authentication through Bearer token in the Authorization header. The token should be included in all API requests in the headers:

Authorization: Bearer {token}

Common Error Responses

Not Found Error

{
	"success": false,
	"status": "404 NOT_FOUND",
	"message": "Policy rule not found",
	"data": null
}

Validation Error

{
	"success": false,
	"status": "400 BAD_REQUEST",
	"message": "Invalid operator value",
	"data": null
}

Authorization Error

{
	"success": false,
	"status": "401 UNAUTHORIZED",
	"message": "Invalid or expired token",
	"data": null
}