Create Pattern

Create a new pattern for a specified pattern group.

HTTP Request

POST /api/sonar/pattern-groups/:guid/patterns
Request using cURL
curl -H "Authorization: Bearer <API_KEY>" \
     -d expr="""/.git/HEAD""" \
     -d rule="/.git/HEAD file scan" \
     -X POST \
     https://HOSTNAME/api/sonar/pattern-groups/e93dafa7-6215-4e98-8bfc-1e0a67171bf1/patterns
Request Parameters
KeyRequiredTypeDescriptionNote
guidOStringPattern group GUID36 characters
exprOStringKeyword boolean expressionMinimum 3 to maximum 1,000 characters
expr2XStringValidation expressionMaximum 1,000 characters
ruleOStringPattern nameMaximum 1,000 characters

Success Response

{}

Error Responses

Required argument is missing

HTTP status code 400.

{
    "error_code": "null-argument",
    "error_msg": "expr should be not null"
}
Invalid argument length

HTTP status code 400.

{
    "error_code": "invalid-argument",
    "error_msg": "'expr' must be less than or equal to 1000 characters."
}
Invalid keyword boolean expression

HTTP status code 400.

{
    "error_code": "invalid-argument",
    "error_msg": "expr syntax error: not-quoted"
}
No privilege to create a pattern

HTTP status code 500 .

{
    "error_code": "illegal-state",
    "error_msg": "no-permission"
}