Open topic with navigation

# hosts

## Description

Adds a host or returns a list of hosts.

## URL

    /Admin/rest/v1/hosts

## Remarks

The host data can be passed as XML containing the equivalent data.

To add a host to LAB_PROJECT, you need to send an HTTP request to create a Host resource.

## HTTP Method

POST: Creates the host.

GET: Returns a list of hosts.

## Request

Headers:

Content-Type: application/xml

Accept: application/xml

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 describing the host.

The fields in the request are:

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_PPROJECT. 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_PPROJECT.
SslEnabled | 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.
Pools | Contains PoolID sub elements which list the ID of the pools to which the host is assigned.

Request Example

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

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

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

hosts/{hostID}
Get Hosts List by Query