/api/2.0/fo/compliance/policy
[POST]
Use the add, remove and set options to manage asset tags for your compliance policies. You must have permission to modify the policy you want to update.
Parameter |
Description |
action |
(Required) Specify one of the following actions (using POST): - set_asset_tags - Specify this action to overwrite the asset tags for a policy. Any assigned asset tags not specified in the request will be removed from the policy. - add_asset_tags - Specify this action to add asset tags to the policy. When specified, we check whether the asset tags specified in the request are already associated with the policy and only add the asset tags that are new to the policy. - remove_asset_tags - Specify this action to remove asset tags from the policy. Note: With the remove_asset_tags action, you must set either tag_set_include or tag_set_exclude parameter, or both the parameters. |
id={value} |
(Required) Policy ID for the policy you want to update. |
evaluate_now={0|1} |
(Optional) Specify evaluate_now=1 to immediately evaluate the policy against assigned assets, and select the Evaluate Now check box in the UI Policy Editor. When this check box is selected we’ll start policy evaluation each time you save changes to the policy from the UI or API. |
tag_include_selector={all|any} |
(Optional) Select “any” (the default) to include hosts that match at least one of the selected tags. Select “all” to include hosts that match all of the selected tags. |
tag_exclude_selector={all|any} |
(Optional) Select “any” (the default) to exclude hosts that match at least one of the selected tags. Select “all” to exclude hosts that match all of the selected tags. |
tag_set_by={id|name} |
(Optional) Specify “id” (the default) to select a tag set by providing tag IDs. Specify “name” to select a tag set by providing tag names. |
tag_set_include={tag id|name} |
(Optional) Specify a tag set to include. Hosts that match these tags will be included. You identify the tag set by providing tag name or IDs. Multiple entries are comma separated. |
tag_set_exclude={tag id|name} |
(Optional) Specify a tag set to exclude. Hosts that match these tags will be excluded. You identify the tag set by providing tag name or IDs. Multiple entries are comma separated. |
Use action=add_asset_tags to add asset tags to the policy. When specified, we check whether the asset tags specified in the request are already associated with the policy and only add the asset tags that are new to the policy.
API request
curl -u "USERNAME:PASSWORD" -H "X-Requested-With: Curl" -X "POST" -d "id=4201701&tag_set_include=118766028&tag_include_selector=all
"https://qualysapi.qualys.com/api/2.0/fo/compliance/policy/?action=add_asset_tags"
XML output
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysapi.qualys.com/api/2.0/fo/compliance/policy/simple_return.dtd">
<SIMPLE_RETURN>
<RESPONSE>
<DATETIME>2022-01-19T06:35:40Z</DATETIME>
<TEXT>Compliance Policy successfully modified.</TEXT>
<ITEM_LIST>
<ITEM>
<KEY>ID</KEY>
<VALUE>4201701</VALUE>
</ITEM>
</ITEM_LIST>
</RESPONSE>
</SIMPLE_RETURN>
Use action=remove_asset_tags to remove asset tags from the policy
API request
curl -u "USERNAME:PASSWORD" -H "X-Requested-With: Curl" -X "POST" -d "id=4201701&tag_set_include=118766028&tag_include_selector=all
"https://qualysapi.qualys.com/api/2.0/fo/compliance/policy/?action=remove_asset_tags"
XML output
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysapi.qualys.com/api/2.0/fo/compliance/policy/simple_return.dtd">
<SIMPLE_RETURN>
<RESPONSE>
<DATETIME>2022-01-19T06:35:40Z</DATETIME>
<TEXT>Compliance Policy successfully modified.</TEXT>
<ITEM_LIST>
<ITEM>
<KEY>ID</KEY>
<VALUE>4201701</VALUE>
</ITEM>
</ITEM_LIST>
</RESPONSE>
</SIMPLE_RETURN>
Use action=set_asset_tags to overwrite the asset tags for a policy. Any assigned asset tags not specified in the request will be removed from the policy.
API request
curl -u "USERNAME:PASSWORD" -H "X-Requested-With: Curl" -X "POST" -d "id=4201701&tag_set_include=118766028&tag_include_selector=all "https://qualysapi.qualys.com/api/2.0/fo/compliance/policy/?action=set_asset_tags"
XML output
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysapi.qualys.com/api/2.0/fo/compliance/policy/simple_return.dtd">
<SIMPLE_RETURN>
<RESPONSE>
<DATETIME>2022-01-19T06:28:30Z</DATETIME>
<TEXT>Compliance Policy successfully modified.</TEXT>
<ITEM_LIST>
<ITEM>
<KEY>ID</KEY>
<VALUE>4201701</VALUE>
</ITEM>
</ITEM_LIST>
</RESPONSE>
</SIMPLE_RETURN>
<platform API server>/api/2.0/fo/simple_return.dtd