Add a host
Description
Adds a host or returns a list of hosts.
URL
/LoadTest/rest/domains/{domainName}/projects/{projectName}/hosts
Remarks
The host data can be passed as XML or JSON containing the equivalent data.
To add a host to LAB_PROJECT, you need to send an HTTP request to create a Host resource. The host will be added as a private host. The host is added to the pool assigned to the project used in the request URL (the part being sent in the domainName and projectName fields).
HTTP Method
POST: Creates the host.
GET: Returns a list of hosts.
Request
Headers:
One of the following:
Content-Type: application/xml
Content-Type: application/json
Cookies:
Version 2020 (or later) | LWSSO_COOKIE_KEY={LwssoCookie}; |
Versions earlier than 2020 | LWSSO_COOKIE_KEY={LwssoCookie};QCSession={QCSessionCookie}; |
Request Body:
GET: No request body.
POST: An XML or JSON describing the host. The fields in the request and response are:
Element | Description |
---|---|
LabHost | The top-level element. |
Name | The host name. |
Installation | The installation type:
|
HostPurposes | Can contain HostPurpose sub elements with any combination of the following:
|
Status | The status can be:
|
Location | (Optional) A valid location name defined in LAB_PPROJECT. If not provided, the default location is used. |
MIListener | Optional when the location is not defined as over a firewall (OFW). When the location is an OFW location, the value should be the name of a valid MIListener that is defined in LAB_PPROJECT. |
Attributes | Can contain Attribute sub elements in order to set Host properties values. |
Attribute | Attribute value should contain Host Properties values as defined in LAB_PROJECT under Project Customization > Project Lists > Host Properties. You can specify multiple Attribute elements using either the default host attributes (as in the example below) or any custom attribute defined by the user. |
Priority | A numeric value between 1 and 9. |
SslEnabled | One of:
|
Enable IPv6 (Available in versions: 24.3 and later) | One of:
|
ID | The host ID. |
![Closed](../Skins/Default/Stylesheets/Images/transparent.gif)
GET http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/hosts
Content-Type: application/xml
Cookie: LWSSO_COOKIE_KEY={LwssoCookie};
![Closed](../Skins/Default/Stylesheets/Images/transparent.gif)
POST http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/hosts
Content-Type: application/xml
Cookie: LWSSO_COOKIE_KEY={LwssoCookie};
<LabHost xmlns="http://www.hp.com/PC/REST/API">
<Name>testingHost</Name>
<Installation>WindowsHost</Installation>
<HostPurposes>
<HostPurpose>Controller</HostPurpose>
<HostPurpose>LoadGenerator</HostPurpose>
</HostPurposes>
<Status>Operational</Status>
<Location>Default</Location>
<MIListener>None</MIListener>
<Attributes>
<Attribute>HostMemory:High</Attribute>
<Attribute>HostStrength:Medium</Attribute>
<Attribute>InstalledComponents:DotNetFramework</Attribute>
<Attribute>InstalledComponents:CitrixClient</Attribute>
<Attribute>InstalledComponents:JavaRuntime</Attribute>
</Attributes>
<Priority>5</Priority>
<SslEnabled>false</SslEnabled>
<IPv6Enabled>true</IPv6Enabled>
</LabHost>
POST http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/hosts
Content-Type: application/json
Cookie: LWSSO_COOKIE_KEY={LwssoCookie};
{
"Name": "[test]Test_Host1",
"Installation": "WindowsStandaloneLG",
"HostPurposes": [
"LoadGenerator"
],
"Status": "Operational",
"Location": "Default",
"MIListener": "None",
"Priority": "7",
"SslEnabled": "false",
"IPv6Enabled": "false",
"Attributes": [
"Host memory:High"
],
"Description": "created by automation",
"Pools": [
"1000"
]
}
Response
Headers:
One of:
Accept: application/xml
Accept: application/json
Cookies:
None
HTML Return Code:
One of the HTTP Return Codes
Upon successful creation, returns HTTP status 201 (Created).
HTML Body:
The data on the entity in the response.
![Closed](../Skins/Default/Stylesheets/Images/transparent.gif)
<LabHost>
<Name>[test]Test_Host2</Name>
<Installation>OneLG</Installation>
<HostPurposes>
<HostPurpose>LoadGenerator</HostPurpose>
</HostPurposes>
<Status>Operational</Status>
<Location>Default</Location>
<MIListener>None</MIListener>
<Attributes>
<Attribute>Host memory:High</Attribute>
</Attributes>
<Priority>7</Priority>
<SslEnabled>false</SslEnabled>
<IPv6Enabled>false</IPv6Enabled>
<Description>created by automation</Description>
<Source>Local</Source>
<Pools>
<PoolID>1000</PoolID>
</Pools>
<IsPrivateHost>false</IsPrivateHost>
<ID>1832</ID>
<CloudAccount />
</LabHost>
{
"IsPrivateHost": false,
"ID": 1831,
"HostPurposes": [
1
],
"Status": 0,
"CloudAccount": "",
"Description": "created by automation",
"Source": "Local",
"Pools": [
1000
],
"Name": "[test]Test_Host1",
"Installation": 1,
"Location": "Default",
"MIListener": "None",
"Attributes": [
"Host memory:High"
],
"Priority": 7,
"SslEnabled": false,
"Ipv6Enabled": false,
"Domain": null,
"UserName": null
}
See Also