Retrieving Rule Information

You can use the Rule Viewer APIs to retrieve information about rules.

Rule Viewer API Examples

Rules with High Permissiveness Level

The following query generates a list of the first two rules that have a Permissiveness Level of "HIGH". This allows you to identify rules that may not be complaint with company standards and may need to me modified.

{
  rules(filter: "permissivenessLevel='HIGH'") {
    values {
      name
      permissivenessLevel
    }
  }
}

Output

{
  "data": {
    "rules": {
      "values": [
        {
          "name": "rule 1",
          "permissivenessLevel": "HIGH"
        },
        {
          "name": "rule 2",
          "permissivenessLevel": "HIGH"
        }
      ]
    }
  }
}

Rules that are Shadowed

The following query retrieves a list of the first two rules that are fully shadowed. This helps identify rules that may be possible to decommission as they are shadowed by other rules in the system and therefore are never used.

{
  rules(filter: "fullyShadowed = true") {
    values(first: 2) {
      name
      shadowed
    }
  }
}

Output

{
  "data": {
    "rules": {
      "values": [
        {
          "name": "Rule 1",
          "shadowed": "FULLY_SHADOWED"
        },
        {
          "name": "Rule 2",
          "shadowed": "FULLY_SHADOWED"
        }
      ]
    }
  }
}

Rules Modified in the Last 30 days

The following query generates a list of the first two rules that were modified in the last 30 days. This could be useful if a recent change has caused issues and you need to identify which rules have changed recently that may have been the cause of the problem.

{
  rules(filter: "timeLastModified before 30 days ago") {
    values(first: 2) {
      name
      timeLastModified 
    }
  }
}

Output

{
  "data": {
    "rules": {
      "values": [
        {
          "name": "Rule 1",
          "timeLastModified": "2019-12-29T22:00:31.297Z"
        },
        {
          "name": "Rule 2",
          "timeLastModified": "2019-12-29T22:00:31.297Z"
        }
      ]
    }
  }
}

Rules with Comments that Contains Specific Text

The following query generates a list of rules that contain the text "test" in the Comments.

{
  rules(filter: "comment contains 'test'") {
    values {
      name
      comment
    }
  }
}

Output

{
  "data": {
    "rules": {
      "values": [
        {
          "name": "1970 - AR1 - test",
          "comment": "testing shared rule -1"
        },
        {
          "name": "Group_Demo",
          "comment": "this has a comment for group testing "
        },
        {
          "name": "ipv6-shadowed",
          "comment": "test2 2"
        },
        {
          "name": "violations for inteazone",
          "comment": "test"
        }
      ]
    }
  }
}