IPv6 Mapping Records XML

How to add and remove IPv6 mapping records in XML format.

Add IPv6 Records in XML FormatAdd IPv6 Records in XML Format

1) View mapping records in XML

API Request

$ curl -u username:password -H "X-Requested-With: curl""https://<qualys_base_url>/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://<qualys_base_url>/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>

2) Prepare file2.xml with records to be added

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>

3) POST data from file2.xml (Success)

API Request

$ curl -u username:password -H "X-Requested-With: curl"-d @file2.xml "https://<qualys_base_url>/api/2.0/fo/asset/ip/v4_v6/"

XML Output

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://<qualys_base_url>/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>

Remove IPv6 Records in XML FormatRemove IPv6 Records in XML Format

1) View mapping records in XML

API Request

$ curl -u username:password -H "X-Requested-With: curl""https://<qualys_base_url>/api/2.0/fo/asset/ip/v4_v6/?action=list&output_format=xml"

2) Prepare file4.xml with records to be removed

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=
&lt;IP_MAP_LIST&gt;
  &lt;IP_MAP&gt;
    &lt;V4&gt;0.0.0.4&lt;/V4&gt;
    &lt;V6&gt;2001:470:8418:a18::a0a:1849&lt;/V6&gt;
  &lt;/IP_MAP&gt;
  &lt;IP_MAP&gt;
    &lt;V4&gt;0.0.0.5&lt;/V4&gt;
    &lt;V6&gt;2001:470:8418:a18::a0a:189c&lt;/V6&gt;
  &lt;/IP_MAP&gt;
&lt;/IP_MAP_LIST&gt;

3) POST data from file4.xml (Success)

API Request

$ curl -u username:password -H "X-Requested-With: curl"-d @file4.xml "https://<qualys_base_url>/api/2.0/fo/asset/ip/v4_v6/"

XML Output

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE SIMPLE_RETURN SYSTEM "https://<qualys_base_url>/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>