Update Pattern

Updates the pattern of a specified pattern group.

Required Permissions

Requires the ADMIN role or higher.

HTTP Request

PUT /api/sonar/pattern-groups/:guid/patterns/:id
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d expr=""/.git/HEAD"" \
     -d expr2="path == ""*/.git/HEAD""" \
     -d rule="/.git/HEAD file scan" \
     -X PUT \
     https://HOSTNAME/api/sonar/pattern-groups/e93dafa7-6215-4e98-8bfc-1e0a67171bf1/patterns/123
Request Parameters
Path Parameters
KeyTypeDescriptionNote
guidStringPattern group GUID36 characters
Request Body Parameters
KeyRequiredTypeDescriptionNote
exprYesStringKeyword boolean expressionMinimim 3 to maximum 1,000 characters
expr2NoStringValidation expressionMaximum 1,000 characters
ruleYesStringPattern 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"
}
expr parameter length is invalid

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'expr' must be longer than or equal to 3 characters."
}
Invalid keyword search expression syntax

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "expr syntax error: not-quoted"
}
Pattern group is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "pattern group not found: 28ad21b2-585c-4b68-9fad-b78711078496"
}
Pattern is not found

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "pattern not found: group guid-28ad21b2-585c-4b68-9fad-b78711078496 id-112"
}
Permission denied

HTTP status code 500

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