Update a Dynamic Tag

You can update the dynamic tag using the Container Security APIs.

PUT/csapi/v1.3/tag/update

Input ParametersInput Parameters

Parameter

Mandatory/Optional

Data Type

Description

entityTypeToAdd Mandatory array of objects This is used to specify new entity-type rules to the configuration. It accepts a list of entity definitions, where each entry specifies the entity type and the rule to apply to it.
entityTypeRuleToUpdate Mandatory object (Key-value pairs) This is used to update existing rules for specific entity types. Each key represents an entity type, and its value is the corresponding rule expression.
entityType Mandatory string Type of entity (e.g., IMAGE, CONTAINER)
rule Mandatory string Rule expression associated with the entity

Provide only one parameter at a time, either entityTypeToAdd or entityTypeRuleToUpdate.

Sample: Update Dynamic TagSample: Update Dynamic Tag

The sample below shows the request and response for updating the dynamic tag. 
API Request to update entityTypeToAdd

curl -X 'PUT' \
  '<qualys_base_url>/csapi/v1.3/tag/update' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "ai_test1",
  "reevaluate": true,
   "entityTypeToAdd": [
    {
      "entityType": "CONTAINER",
      "rule": "container.state:RUNNING"
    }
  ]
}'

API Response

{
  "tagId": 163606266,
  "name": "ai_test1",
  "backgroundColor": null,
  "foregroundColor": null,
  "icon": null,
  "criticalityScore": null,
  "entityTagInfo": [
    {
      "entityType": "image",
      "dynamicTagRule": "image.source:GENERAL "
    },
    {
      "entityType": "container",
      "dynamicTagRule": "container.state:RUNNING"
    }
  ]
}


API Request to update entityTypeRuleToUpdate

curl -X 'PUT' \
  '<qualys_base_url>/csapi/v1.3/tag/update' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "ai_test1",
  "reevaluate": true,
    "entityTypeRuleToUpdate": {
    "image": "image.imageId:b6a9d6f1254e",
    "container": "container.state:DELETED"
  }
}' 

API Response

{
  "tagId": 163606266,
  "name": "ai_test1",
  "backgroundColor": null,
  "foregroundColor": null,
  "icon": null,
  "criticalityScore": null,
  "entityTagInfo": [
    {
      "entityType": "image",
      "dynamicTagRule": "image.imageId:b6a9d6f1254e"
    },
    {
      "entityType": "container",
      "dynamicTagRule": "container.state:DELETED"
    }
  ]
}