Get Patterns

Get a list of the patterns for a specified pattern group.

HTTP Request

GET /api/sonar/pattern-groups/:guid/patterns
Request using cURL
curl -H "Authorization: Bearer <API_KEY>" \
     https://HOSTNAME/api/sonar/pattern-groups/8df64276-a16e-4bae-93cd-c207c8155159/patterns
Request Parameters
KeyRequiredTypeDescriptionNote
guidOStringPattern group GUID36 characters
offsetX32-bit integerNumber of records to skipDefault: 0
limitX32-bit integerMaximum number of records to loadIf not sepcified, 20
keywordsXStringKeywordSearch available by rule, expr, expr2

Success Response

{
    "total_count": 2,
    "patterns": [
        {
            "id": 112,
            "expr": "\"passwd\"",
            "expr2": "path == \"*passwd\"",
            "rule": "/etc/passwd",
            "created": "2022-09-01 00:31:14+0900",
            "updated": "2022-09-01 00:31:14+0900"
        },
        {
            "id": 113,
            "expr": "\"authorized_keys\"",
            "expr2": "path == \"*authorized_keys\"",
            "rule": "/.ssh/authorized_keys",
            "created": "2022-09-01 00:31:14+0900",
            "updated": "2022-09-01 00:31:14+0900"
        }
    ]
]
  • total_count (32-bit integer): Total number of the patterns that match the search keyword
  • patterns (Array): Pattern list
    • id (32-bit integer): Pattern ID
    • expr (String): Keyword boolean expression
    • expr2 (String): Validation expression that filters the keyword-matching result
    • rule (String): Pattern name
    • created (String): Date and time of creation (yyyy-MM-dd HH:mm:ssZ)
    • updated (String): Date and time of last modification (yyyy-MM-dd HH:mm:ssZ)

Error Responses

offset or limit value is not an integer

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'offset' parameter should be int type"
}
offset or limit value is negative

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'offset' must be greater than or equal to 0."
}