Create rule
Creates a new authorization rule within an organization.
Endpoint
POST /api/Rule
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Name of the rule |
description | String | No | Description of the rule's purpose |
enabled | Boolean | Yes | Whether the rule is active |
definition | String | No | The rule definition, expressed as a JSON-encoded string. |
partitionGlobalId | GUID | Yes | The global identifier of the organization. For steps on retrieving partitionGlobalId, refer to Retrieving partitionGlobalId for API use. |
Request headers
--header 'Authorization: Bearer {access_token}'
--header 'Content-Type: application/json'
Responses
note
- The response returns the created rule as a
RuleDto, including the generatedid. partitionGlobalIdmay be returned as the zero GUID, depending on the environment or rule provider behavior.definitionis persisted and returned as a JSON-encoded string.assignedGroupsis returned as an empty array ([]) when no groups are resolved at creation time.
{
"id": 3684,
"partitionGlobalId": "00000000-0000-0000-0000-000000000000",
"name": "Test",
"description": "Test",
"enabled": true,
"definition": "{\"GroupsToAssign\":[\"4d161738-7204-4794-b839-8f7fed28366c\"],\"Conditions\":[]}",
"assignedGroups": []
}
Example request
{
"name": "Test",
"description": "Test",
"partitionGlobalId": "47a714db-cd27-4250-9668-2054e008c448",
"enabled": true,
"definition": "{\"GroupsToAssign\":[\"4d161738-7204-4794-b839-8f7fed28366c\"],\"Conditions\":[]}"
}
Error responses
400 Bad Request: Invalid request body or validation errors401 Unauthorized: Missing or invalid authentication token403 Forbidden: Insufficient permissions404 Not Found: Organization does not exist