AnsweredAssumed Answered

API delete all IPs from asset group

Question asked by Luigi Pardey on Mar 27, 2018
Latest reply on May 21, 2018 by Sam Friday

Hi,

 

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:

  1. List asset groups
  2. select target asset group
  3. Parse XML to extract all IP_SET entries
  4. Join the parsed IP_SET entries to a comma-separated list
  5. 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...

 

Kind regards,

Luigi

Outcomes