Policy Asset Tags

POST/api/2.0/fo/compliance/policy

Add, remove, and set asset tags for a policy. You must have permission to modify the policy you want to update.

Add asset tags to policy
Use this action to add asset tags to the policy. When specified, we will 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.

Input ParametersInput Parameters

Parameter

Required/Optional

Data Type

Description

action

Required

String 

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

Integer 

Policy ID for the policy you want to update.

evaluate_now={0|1}

Optional

Integer 

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

Boolean 

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

Boolean 

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

Integer/
String 

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

Integer/
String 

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

String/
Integer

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.

Sample - Add Asset TagsSample - Add Asset Tags

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://<qualys_base_url>/api/2.0/fo/compliance/policy/?action=add_asset_tags"

XML Output

<!DOCTYPE SIMPLE_RETURN SYSTEM "https://<qualys_base_url>/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>

Sample - Remove Asset TagsSample - Remove Asset Tags

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://<qualys_base_url>/api/2.0/fo/compliance/policy/?action=remove_asset_tags"

XML Output

<!DOCTYPE SIMPLE_RETURN SYSTEM "https://<qualys_base_url>/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>

Sample - Reset Asset TagsSample - Reset Asset Tags

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://<qualys_base_url>/api/2.0/fo/compliance/policy/?action=set_asset_tags"

XML Output

<!DOCTYPE SIMPLE_RETURN SYSTEM "https://<qualys_base_url>/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>

DTD

<platform API server>/api/2.0/fo/simple_return.dtd

 


 

 

Was this topic helpful?

success Thank you! We're glad to hear that this topic was useful.
success We appreciate your feedback. We'll work to make this topic better for you in the future.