Is there a straightforward way to delete IPs from an asset group via the API?
The AG edit API ("https://qualysapi.qualys.com/api/2.0/fo/asset/group/?action=edit") accepts parameters "set_ips" and "remove_ips".In the API documentation you can find the following text:
The “set” (overwrite) and “remove” operations can cause the asset group to have no IPs, domains, etc depending on the parameter
However, I cannot find a way to cause the AG to have no IPs because...
- set_ips does not allow empty values
- remove_ips does not allow multiple Class A networks (0.0.0.0-255.255.255.255)
I cannot figure out any other way to remove ALL IPs from an asset group, other than the rather convoluted (and very slow) sequence of steps:
- List asset groups
- select target asset group
- Parse XML to extract all IP_SET entries
- Join the parsed IP_SET entries to a comma-separated list
- Call the AG edit API with remove_ips=this_long_string...
Conversely, set_dns_names accepts an empty value, and removes all DNS names from the asset group...