Share this page

# Add hosts and return list of hosts

## Description

Adds a host and returns a list of hosts.

Tip: From OpenText Enterprise Performance Engineering 2021 R2, you can add a host created on the cloud using this API.

## URL

Copy code

    /Admin/rest/v1/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.

This API should be authorized for the Application, Tenant, and Site Admin permission levels.

## 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
--- | ---
2023, 24.1, and later | ADM_LWSSO={ADM_LWSSO_COOKIE_VALUE};
2022 - 2022 R2 | ADM_LWSSO={ADM_LWSSO_COOKIE_VALUE}; ASP.NET_SessionId_Adm={ASP.NET_SessionId_Adm_COOKIE_VALUE}; LWSSO_COOKIE_KEY={LWSSO_COOKIE_KEY_COOKIE_VALUE};
2021 - 2021 R2 | ADM_LWSSO={ADM_LWSSO_COOKIE_VALUE}; ASP.NET_SessionId_Adm={ASP.NET_SessionId_Adm_COOKIE_VALUE};
2020 - 2020 SP3 | ADM_LWSSO={ADM_LWSSO_COOKIE_VALUE};
Earlier than 2020 | LWSSO_COOKIE_KEY={LWSSO_COOKIE_KEY_COOKIE_VALUE}; QCSession={QC_SESSION_COOKIE_VALUE};

Request body:

- GET: No request body.

- POST: An XML or JSON describing the host.

The table lists the fields in the request.

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
Location | (Optional) Specify a value that is a valid location name defined in LAB_PROJECT. Otherwise when this field is 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.
SslEnabled | One of: true false
Enable IPv6 (Available in versions: 24.3 and later) | One of: true false
Status | One of: Operational NonOperational Unavailable
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.
Description | Description of the host.
Source (Available in versions: 2021 R2 and later) | The host's source: Local - A host that exists in your lab. Cloud - A host from your cloud provider. If this field is left blank, the default behavior is preserved and the host is added as Local.
Pools | Contains PoolID sub elements which list the ID of the pools to which the host is assigned.

Request examples:

Copy code
XML example:

    POST http://<LRE_Server>/Admin/rest/v1/hosts
    Content-Type: application/xml
    Accept: application/xml
    Cookie: ADM_LWSSO={AdmLwssoCookie};

    <LabHost>
        <Name>testingHost</Name>
        <Installation>WindowsHost</Installation>
        <HostPurposes>
        <HostPurpose>LoadGenerator</HostPurpose>
        </HostPurposes>
        <Location>Default</Location>
        <MIListener>None</MIListener>
        <Priority>5</Priority>
        <SslEnabled>false</SslEnabled>
        <IPv6Enabled>true</IPv6Enabled>
        <Status>Operational</Status>
        <Attributes>
        <Attribute>Host memory:High</Attribute>
        <Attribute>Host strength:Medium</Attribute>
        </Attributes>
        <Description />
        <Source>Local</Source>
        <Pools>
        <PoolID>1000</PoolID>
        </Pools>
     </LabHost>

Copy code
JSON example:

    POST http://<LRE_Server>/Admin/rest/v1/hosts
    Content-Type: application/xml
    Accept: application/json
    Cookie: ADM_LWSSO={AdmLwssoCookie};
    {
        "Name": "[test]rest_host2",
        "Installation": "WindowsHost",
        "HostPurposes": [
            "Controller",
            "DataProcessor",
            "LoadGenerator"
          ],
        "Status": "Operational",
        "Location": "Default",
        "MIListener": "None",
        "Attributes": [],
        "Priority": 5,
        "SslEnabled": false
    }

## Response

Headers:

Content-Type: application/xml

Cookies:

None

HTML return code:

One of the HTTP return codes

Upon successful deletion, returns HTTP status 201 (Created).

HTML body:

The data on the entity in the response. See Hosts response.

The Location contains the link to the newly created entity.

See also:

- Return, delete, reconfigure, or update a host by ID
- Get hosts list by query

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