Share this page

# Add a host

## Description

Adds a host or returns a list of hosts.

## URL

Copy code

    /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 | Cookie
--- | ---
2020 or later | LWSSO_COOKIE_KEY={LwssoCookie};
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 listed below.

  Element | Description
  --- | ---
  LabHost | The top-level element.
  Name | The host name.
  Installation | The installation type: Unix WindowsHost WindowsStandaloneLG
  HostPurposes | Can contain HostPurpose sub elements with any combination of the following: Controller LoadGenerator DataProcessor
  State (StateName in version 2023 R1 only) | The state can be: Operational NonOperational Unavailable
  Location | (Optional) A valid location name defined in LAB_PROJECT. 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_PROJECT.
  Attributes | Can contain attribute sub elements in order to set Host property values. To retrieve a list of attributes, see Get host attributes.
  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: true false
  Enable IPv6 (Available in versions: 24.3 and later) | One of: true false
  ID | The host ID.

Request examples:

Copy code
Request Example - GET:

    GET http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/hosts
    Content-Type: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Copy code
XML example - POST:

    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>
        <State>Operational</State>
        <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>

Copy code
JSON example - POST:

    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"
            ],
            "State": "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 code 201 (Created).

HTML body:

The data on the entity in the response.

Response examples:

Copy code
XML example - POST:

    <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>

Copy code
JSON example - POST:

    {
        "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:

- Get or delete a host by ID
- Get Hosts List by query

Tips to improve your search results... OpenText™ Enterprise Performance Engineering API Reference OpenText™ Enterprise Performance Engineering All View Local Help Center View Online Help Center(Undefined variable: _rscC_Basic_Variables.VersionLabel)