How to add and remove IPv6 mapping records in XML format.
API request
$ curl -u username:password -H "X-Requested-With: curl"
"https://qualysguard.api.qualys.com/api/2.0/fo/asset/ip/v4_v6/?action=list&output_format=xml"
Qualys automatically returns an ID value in the <ID> element for each IPv6 mapping record. This ID is assigned by Qualys when the record is created.
XML output
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE IP_MAP_LIST_OUTPUT SYSTEM
"https://qualysapi.qualys.com/api/2.0/fo/asset/ip/v4_v6/ip_map_list_output.dtd">
<IP_MAP_LIST_OUTPUT>
<RESPONSE>
<DATETIME>2017-11-28T19:42:10Z</DATETIME>
<IP_MAP_LIST>
<IP_MAP>
<ID>46947</ID>
<V4>0.0.0.7</V4>
<V6>2001:db8:85a3::8a2e:370:84</V6>
</IP_MAP>
<IP_MAP>
<ID>47036</ID>
<V4>0.0.0.1</V4>
<V6>2001:db8:85a3::8a2e:370:77</V6>
</IP_MAP>
</IP_MAP_LIST>
</RESPONSE>
</IP_MAP_LIST_OUTPUT>
The XML file contents identify one or more IPv6 mapping records to be added. The element in the XML upload file are described below.
<V4> (Required) An IPv4 address. The IPv4 address can be defined in only one IPv6 mapping record within your subscription.
<V6> (Required) An IPv6 address. The IPv6 address can be defined in only one IPv6 mapping record within your subscription.
<ID> (Optional) A user-defined, custom ID may be included. Important: Custom ID values will not be saved with record data within your subscription.
The XML file must include the input parameters action=add and xml_data=. The parameter all_or_nothing is optional. When set to 1 or unspecified, the service cancels the request and does not add any new records if it finds the upload data has one record with an IP conflict. When set to 0 the service does not cancel the request if an IP conflict is found.
Sample file2.xml used to add IPv6 mapping records
$ cat file2.xml
action=add&xml_data=
<IP_MAP_LIST>
<IP_MAP>
<V4>0.0.0.2</V4>
<V6>2001:470:8418:a18::a0a:1805</V6>
</IP_MAP>
<IP_MAP>
<V4>0.0.0.3</V4>
<V6>2001:470:8418:a18::a0a:ab7</V6>
</IP_MAP>
</IP_MAP_LIST>
API request
$ curl -u username:password -H "X-Requested-With: curl"
-d @file2.xml "https://qualysguard.api.qualys.com/api/2.0/fo/asset/ip/v4_v6/"
XML output
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysguard.api.qualys.com/api/2.0/simple_return.dtd">
<SIMPLE_RETURN>
<RESPONSE>
<DATETIME>2017-11-03T20:59:07Z</DATETIME>
<TEXT>Successfully imported 2 records</TEXT>
</RESPONSE>
</SIMPLE_RETURN>
API request
$ curl -u username:password -H "X-Requested-With: curl"
"https://qualysguard.api.qualys.com/api/2.0/fo/asset/ip/v4_v6/?action=list&output_format=xml"
The XML file contents identify one or more IPv6 mapping records to be removed.
Sample file4.xml used to remove IPv6 mapping records
$ cat file4.xml
action=remove&xml_data=
<IP_MAP_LIST>
<IP_MAP>
<V4>0.0.0.4</V4>
<V6>2001:470:8418:a18::a0a:1849</V6>
</IP_MAP>
<IP_MAP>
<V4>0.0.0.5</V4>
<V6>2001:470:8418:a18::a0a:189c</V6>
</IP_MAP>
</IP_MAP_LIST>
API request
$ curl -u username:password -H "X-Requested-With: curl"
-d @file4.xml "https://qualysguard.api.qualys.com/api/2.0/fo/asset/ip/v4_v6/"
XML output
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysguard.api.qualys.com/api/2.0/simple_return.dtd">
<SIMPLE_RETURN>
<RESPONSE>
<DATETIME>2017-11-03T20:59:07Z</DATETIME>
<TEXT>Removed 2 records (any associated scanned host data is now queued for purging)</TEXT>
</RESPONSE>
</SIMPLE_RETURN>