Docs

Add Rule

POST /rule-sets/{ruleSetId}/rules

POST/rule-sets/{ruleSetId}/rules

Required Tokens

FieldTypeRequiredDescription
BearerAuthorization: Bearer <api-key>OptionalYour API key. Pass it as the Bearer token on every request.
Organization tokenx-Organization-TokenOptionalRun **Authorize Organization** in the Authorization folder.

Adds a rule. Resources governed by the set are re-evaluated.

Requires ResourceTypeDatabase.Edit permission.

Path Parameters

FieldTypeRequiredDescription
ruleSetIdGuidRequiredThe rule set.

Request Body

FieldTypeRequiredDescription
namestringRequiredRule name.
descriptionstringOptionalDescription.
priorityintRequiredEvaluation order.
conditionTypestringRequired`BlockDuration`, `TimeSinceClearance` or `TimeOfDayWindow`.
trackedBlockTypeIdGuid?OptionalThe block type the rule tracks.
isActiveboolOptionalDefaults to `true` on create.
windowStart / windowEndtime?Optional`HH:mm:ss`, for `TimeOfDayWindow`. When both are equal the window covers the whole day.
resultingStateIdGuid?OptionalState applied inside the window.
daysOfWeekstring[]Optional`Sunday` to `Saturday`.
annualDatesstring[]Optional`TimeOfDayWindow` only. Dates that repeat every year, either `MM-DD` (`07-04`) or the Nth or last weekday of a month, `MM-{ordinal}-{weekday}` (`05-Last-Monday`). Ordinal is `1`, `2`, `3`, `4` or `Last`. No duplicates.

A TimeOfDayWindow rule is live on a day when the weekday is in daysOfWeek or the day matches an entry in annualDates. With neither set, it is live every day. With dates only, it is live on those dates alone. A date matches the actual calendar day, never a weekend observance.

Response

201 Created. No response body.

Error Codes

HTTP StatusDescription
400Invalid arguments, including annualDates on a BlockDuration or TimeSinceClearance rule, a malformed date, or duplicates.
404Rule set, block type or state not found.