Web API Reference Guide > Available API Methods > Virtual Hosts Methods > The vhostAddSecure Method

The vhostAddSecure Method

This action is similar to vhostAdd, it adds a new vhost which is intended to be secure using SSL. Receives name, port, template and certificate paths and returns a single virtual host element with the same information.

Version: 1.6

Required Permissions: Read-only

HTTP method: POST

Supported by Editions: Zend Server

Request Parameters:

Parameter

 Type

Required

Description

name

String

Yes

Name of virtual host.

port

Integer

Yes

Port of virtual host.

sslCertificatePath

String

Yes

File path to locate the SSL certificate file.

sslCertificateKeyPath

String

Yes

File path to locate the SSL public key file.

template

String

No

Template of the virtual hostsettings according to the web server configuration options.

sslCertificateChainPath

String

No

Full file path to the SSL chain file.

forceCreate

Boolean

No

Force the creation of a virtual host, even if it fails syntax validation. Default: FALSE

Expected Response Code: 200 OK  - For more information see Response Format.

Response Type: vhost

Possible Action Specific Error Codes:

HTTP Code

 Error Code

Description

406

serverConfigurationError

The template provided as virtual hostconfiguration has failed syntax or staging checks. A detailed message will appear to explain the failure.

Example

Usage Example

Request

POST /ZendServer/Api/vhostAddSecure

name=foo&port=666&sslCertificatePath=/usr/local/zend/var/sites.d/certs&sslCertificatePath=/usr/local/zend/var/sites.d/keys

Response

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

<zendServerAPIResponse xmlns="http://www.zend.com/server/api/1.6">

<requestData>

<apiKeyName>angel.eyes</apiKeyName>

<method>vhostAddSecure</method>

</requestData>

<responseData>

<vhostList>

<vhostInfo>

<id>1</id>

<name>foo</name>

<port>80</port>

<status>Adding</status>

<default>true</default>

<zendDefined>true</zendDefined>

<zendManaged>true</zendManaged>

<ssl>false</ssl>

<created>1970-01-01T02:00:00+02:00</created>

<lastUpdated>1970-01-01T02:00:00+02:00</lastUpdated>

<createdTimestamp>1367237856</createdimestamp>

<lastUpdatedTimestamp>1367237856</lastUpdatedTimestamp>

<servers>

<vhostServer>

<id>1</id>

<status>Ok</status>

<lastMessage><![CDATA[]]></lastMessage>

</vhostServer>

...

</servers>

</vhostInfo>

...

</vhostList>

</responseData>

</zendServerAPIResponse>

 

Read Also

  Available API Methods    
  Virtual Hosts Methods