Skip to content
Get started

List rules for a detector

detectors.rules.list(strdetector_id) -> RuleListResponse
GET/api/detectors/{detectorId}/rules

List rules for a detector

ParametersExpand Collapse
detector_id: str
ReturnsExpand Collapse
class RuleListResponse:
errors: List[Error]
code: int
minimum1000
message: str
messages: List[Message]
code: int
minimum1000
message: str
result: Result
rules: List[ResultRule]
id: str
condition: Condition
One of the following:
class LeafCondition:
leaf: Leaf
fact: str
op: Literal["eq", "neq", "in", 4 more]
One of the following:
"eq"
"neq"
"in"
"nin"
"contains"
"matches"
"between"
value: Union[str, float, bool, 2 more]
One of the following:
str
float
bool
List[str]
List[float]
class RefCondition:
ref: Ref
fact: str
op: Literal["eq", "neq", "in", "nin"]
One of the following:
"eq"
"neq"
"in"
"nin"
reference: str
class InRelationCondition:
in_relation: InRelation
args: List[object]
relation: str
class AllCondition:
all: List[Condition]
class AnyCondition:
any: List[Condition]
class NotCondition:
not_: Condition
class OnceCondition:
once: Condition
class HistoricallyCondition:
historically: Condition
class SinceCondition:
since: Since
left: Condition
right: Condition
class OnceWithinCondition:
once_within: OnceWithin
inner: Condition
window_secs: float
class HistoricallyForCondition:
historically_for: HistoricallyFor
inner: Condition
window_secs: float
boundary: Optional[Literal["weak", "strong"]]
One of the following:
"weak"
"strong"
class SinceWithinCondition:
since_within: SinceWithin
left: Condition
right: Condition
window_secs: float
class KeyedCondition:
keyed: Keyed
inner: Condition
key: str
detector_id: str
enabled: bool
name: str
notify: bool
priority: float
success: bool

List rules for a detector

import os
from rake import Rake

client = Rake(
    api_key=os.environ.get("RAKE_API_KEY"),  # This is the default and can be omitted
)
rules = client.detectors.rules.list(
    "detectorId",
)
print(rules.errors)
{
  "errors": [
    {
      "code": 1000,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message"
    }
  ],
  "result": {
    "rules": [
      {
        "id": "id",
        "condition": {
          "leaf": {
            "fact": "fact",
            "op": "eq",
            "value": "string"
          }
        },
        "detectorId": "detectorId",
        "enabled": true,
        "name": "name",
        "notify": true,
        "priority": 0
      }
    ]
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message"
    }
  ],
  "result": {
    "rules": [
      {
        "id": "id",
        "condition": {
          "leaf": {
            "fact": "fact",
            "op": "eq",
            "value": "string"
          }
        },
        "detectorId": "detectorId",
        "enabled": true,
        "name": "name",
        "notify": true,
        "priority": 0
      }
    ]
  },
  "success": true
}