Remove Patterns

Deletes the specified patterns.

Required Permissions

Requires the ADMIN role or higher.

HTTP Request

DELETE /api/sonar/pattern-groups/:guid/patterns
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -X DELETE \
     "https://HOSTNAME/api/sonar/pattern-groups/638cfeb2-e259-46af-961a-1eeb65ea35f0/patterns?ids=10"
Request Parameters
Path Parameters
KeyTypeDescriptionNote
guidStringPattern group GUID36 characters
Request Body Parameters
KeyRequiredTypeDescriptionNote
idsYesList (of 32-bit integers)Pattern ID listComma-separated list

Success Response

{
  "failures": []
}
  • failures (Array): Items that failed to be deleted. An empty array when every item succeeds.
    • id (String): ID of the pattern that failed to be deleted
    • reason (String): Reason for the failure
Some patterns do not exist

A pattern that does not exist is returned in the failures list.

{
  "failures": [
    {
      "id": "6",
      "reason": "pattern-not-found"
    }
  ]
}

Error Responses

Pattern group identifier is not in valid GUID format

HTTP status code 400

{
    "error_code": "invalid-param-type",
    "error_msg": "guid should be guid type."
}
Pattern identifiers list is not a 32-bit integer list

HTTP status code 400

{
    "error_code": "invalid-argument",
    "error_msg": "'ids' parameter should be int_list type"
}
Pattern is not found

HTTP status code 200

{
    "failures": [
        {
            "id": "6",
            "reason": "pattern-not-found"
        }
    ]
}
No privileges to delete a pattern

HTTP status code 500

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