Create an Exception

Creates a new exception.

POST/csapi/v1.3/exception

Input ParametersInput Parameters

Parameter Mandatory/Optional Data Type Description
name Mandatory string Specify a name for the exception.
reason Mandatory string Specify the reason to create the exception.
explanation Mandatory string Enter explanation to support the reason for creating the exception.
scope Mandatory string Specify the scope: IMAGE or CONTAINER.
When the scope is IMAGE, the exception is automatically cascaded to containers spawned from the image.
listId Mandatory string Specify the ID of the list to be used.
exceptionType Mandatory string Specify the exception type. Currently, only VULNERABILITY is supported.
entityAssignmentRequest Mandatory string

Specify the UUID of the images or containers to be assigned to the exception.

You can either specify the UUIDs directly using "idsToAdd" or specify a filter using "additionFilter".

If "idsToAdd" is specified, "additionFilter" is ignored.

startDate Mandatory string Specify the start date to enforce the exception.
endDate Mandatory string Specify the end date for the exception.
entityAssignment Type Mandatory string A new value, "DYNAMIC", is now available.
When you specify "DYNAMIC", specify a dynamic filter.
dynamicFilter Optional integer Specify a filter using QQL tokens to filter out the images to which you want to assign the exception.
The following QQL tokens are supported:
For images and containers:
- repo.tag
- repo.repository
- repo.registry

For containers:
- cluster.k8s.pod.namespace

Sample: Create a New Vulnerability Exception for Static AssignmentSample: Create a New Vulnerability Exception for Static Assignment

API Request

curl -X "POST"
"<qualys_base_url>/csapi/v1.3/exception"
-H "accept: application/json"
-H "Authorization: Bearer <token>"
-H "Content-Type: application/json"
-d "{
  "name": "testapi123",
  "reason": "RISK_ACCEPTED",
  "explanation": "test",
  "scope": "IMAGE",
  "listId": "19e7e496-feef-445f-9a55-cf1fae843260",
  "exceptionType": "VULNERABILITY",
  "entityAssignmentType": "STATIC",
  "entityAssignmentRequest": {
        "idsToAdd": [
            "9baf9f85-f3bf-3259-b8d5-3cd51967d34a",
            "b5373ff0-044d-3004-8368-88541ae64a75"
        ],
        "additionFilter": null
    },
  "startDate": "1695208995879",
  "endDate": "1695295395879",
}"

Response

{
    "exceptionId": "3f86db22-2a2e-4976-a947-07d575fb50d5"
}

Sample: Create a New Vulnerability Exception for Dynamic AssignmentSample: Create a New Vulnerability Exception for Dynamic Assignment

API Request

curl -X "POST"
"<qualys_base_url>/csapi/v1.3/exception"
-H "accept: application/json"
-H "Authorization: Bearer <token>"
-H "Content-Type: application/json"
-d "{
  "name": "testapi123",
  "reason": "RISK_ACCEPTED",
  "explanation": "test",
  "scope": "IMAGE",
  "listId": "19e7e496-feef-445f-9a55-cf1fae843260",
  "exceptionType": "VULNERABILITY",
  "entityAssignmentType": "DYNAMIC",
  "startDate": "1695208995879",
  "endDate": "1695295395879",
  "dynamicFilter": "repo.tag:rails"
}"

Response

{
    "exceptionId": "3f86db22-2a2e-4976-a947-07d575fb50d5"
}