Manage virtual hosts

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

[POST]

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 Parameters

Parameter

Description

action={action}

(Required) 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) Specify 1 to view (echo) input parameters in the XML output. By default these are not included.

ip={value}

(Required) An IP address for the virtual host configuration.

network_id={value}

(Optional) 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) A port number for the virtual host configuration.

fqdn={value}

(Required for all actions except “delete”. Invalid for “delete”.)

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

Sample - 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://qualysapi.qualys.com/api/2.0/fo/asset/vhost/"

XML output

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysapi.qualys.com/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 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://qualysapi.qualys.com/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 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://qualysapi.qualys.com/api/2.0/fo/asset/vhost/"

XML output

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE SIMPLE_RETURN SYSTEM "https://qualysapi.qualys.com/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