Manage Virtual Hosts

GET POST/api/2.0/fo/asset/vhost/?action={action}

Create, update and delete virtual hosts in the user account. A virtual host must have at least one FQDN. You can add multiple FQDNs to each virtual host if you like. One subscription can have a maximum of 5000 virtual hosts.

Permissions - Managers manage virtual hosts in the subscription. Unit Managers manage virtual hosts in their own business unit when granted this permission. Scanners have permission to manage virtual hosts in their account when granted this permission. Readers, Auditors do not have permission to manage virtual hosts.

Input ParametersInput Parameters

Parameter

Required/Optional

Data Type

Description

action={action}

Required String 

The action can be one of:

create - create a virtual host

update - update/edit a virtual host

delete - delete a virtual host

add_fqdn - add one or more FQDNs to a virtual host

delete_fqdn - remove one or more FQDNs from a virtual host (it's not possible to remove all FQDNs defined for a virtual host)

echo_request={0|1}

Optional Integer 

Specify 1 to view (echo) input parameters in the XML output. By default these are not included.

ip={value}

Required Integer 

An IP address for the virtual host configuration.

network_id={value}

Optional Integer 

Network support must be enabled to specify the network_id. If network support is enabled and you do not provide a network_id, then the Default Global Network is considered. You can specify only one network_id.

port={value}

Required Integer 

A port number for the virtual host configuration.

fqdn={value}

Required for all actions except “delete”. Invalid for “delete” String/
Integer 

One or more fully-qualified domain names (FQDNs) for the virtual host configuration. Multiple entries are comma separated.

Sample - Create Virtual HostSample - Create Virtual Host

API Request

curl -u "USERNAME:PASSWORD" -H "X-Requested-With:curl" -X POST"action=create&ip=10.10.25.212&port=80&fqdn=www.abc123abc.com" "https://<qualys_base_url>/api/2.0/fo/asset/vhost/"

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>2018-04-27T08:45:22Z</DATETIME>
   <TEXT>Virtual host successfully created.</TEXT>
 </RESPONSE>
</SIMPLE_RETURN>

Sample - Create Virtual Host in a NetworkSample - Create Virtual Host in a Network

API Request

curl -u "username:password" -H "Content-type: text/xml" -X "POST"-d "action=create&network_id=5004&ip=10.10.10.20&port=8080&fqdn=example1.fqdn.com,example2.fqdn.com""https://<qualys_base_url>/api/2.0/fo/asset/vhost/"

XML Output

<SIMPLE_RETURN>
        <RESPONSE>
            <DATETIME>2019-11-22T07:27:52Z</DATETIME>
            <TEXT>Virtual host successfully created.</TEXT>
        </RESPONSE>
    </SIMPLE_RETURN>

Sample - Add FQDNs to a Virtual HostSample - Add FQDNs to a Virtual Host

API Request

curl -u "USERNAME:PASSWORD" -H "X-Requested-With:curl" -X POST "action=add_fqdn&ip=10.10.25.212&port=80&fqdn=www.abc123abc.com" "https://<qualys_base_url>/api/2.0/fo/asset/vhost/"

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>2018-04-27T08:45:48Z</DATETIME>
   <TEXT>Virtual host FQDN(s) successfully added.</TEXT>
 </RESPONSE>
</SIMPLE_RETURN>

More Samples

Qualys API - Virtual Host samples - Manage Virtual Hosts  (GitHub)

DTD

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