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/
Request Parameters
| Key | Required | Type | Description | Note |
|---|---|---|---|---|
| guid | O | String | Pattern group GUID | 36 characters |
| expr | O | String | Keyword boolean expression | Minimim 3 to maximum 1,000 characters |
| expr2 | X | String | Validation expression | Maximum 1,000 characters |
| rule | O | String | Pattern name | Maximum 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 privileges to update a pattern
HTTP status code 500
{
"error_code": "illegal-state",
"error_msg": "no-permission"
}