Share this page

# Get Hosts List by query

## Description

Returns a list of hosts by query (filter).

## URL

Copy code

    /LoadTest/rest/domains/{domainName}/projects/{projectName}/hosts?query={name["host name"]}

Where:

Copy code

    query={<QUERY_NAME>["<YOUR_QUERY_VALUE>"]}

## Hosts query values

QUERY_NAME options:

-     Name

- `State` (or `StateName` in version 2023 R1 only)

-     RuntimeState (or RuntimeStateString in version 2023 R1 only)

-     Purpose

-     Priority

-     Source

## HTTP method

GET: Returns a list of hosts by query.

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

None

Request examples:

Copy code
Request example for hosts with a specific name:

    GET http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/Hosts?query={name["host name"]}
    Content-Type: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Copy code
Request example for hosts with a specific state

    GET http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/Hosts?query={State["Unavailable"]}
    Content-Type: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Copy code
Request example for hosts with a specific priority:

    GET http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/Hosts?query={Priority["1"]}
    Content-Type: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Copy code
Request example for hosts with a specific host purpose and state:

    GET http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/Hosts?query={Purpose['*Controller*'];State["Operational"]}
    Content-Type: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

## Response

Headers:

One of:

- Accept: application/xml

- Accept: application/json

Cookies:

None

HTML return code:

One of the HTTP return codes

HTML body:

GET: Returns the data on the entity in the response.

Response examples:

Copy code
XML example:

    <LabHosts>
        <LabHost>
            <Name>MY_SERVER_URL</Name>
            <Installation>WindowsHost</Installation>
            <HostPurposes>
                <HostPurpose>Controller</HostPurpose>
                <HostPurpose>LoadGenerator</HostPurpose>
                <HostPurpose>DataProcessor</HostPurpose>
            </HostPurposes>
            <Status>Operational</Status>
            <Location>Default</Location>
            <MIListener>None</MIListener>
            <Attributes />
            <Priority>5</Priority>
            <SslEnabled>false</SslEnabled>
            <IPv6Enabled>false</IPv6Enabled>
            <Description>created by automation</Description>
            <Source>Local</Source>
            <Pools>
                <PoolID>1000</PoolID>
            </Pools>
            <IsPrivateHost>false</IsPrivateHost>
            <ID>1792</ID>
        </LabHost>
        <LabHost>
            <Name>MY_SERVER_URL</Name>
            <Installation>OneLG</Installation>
            <HostPurposes>
                <HostPurpose>LoadGenerator</HostPurpose>
            </HostPurposes>
            <Status>Operational</Status>
            <Location>Default</Location>
            <MIListener>None</MIListener>
            <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>1794</ID>
        </LabHost>
    </LabHosts>

Copy code
JSON example:

    [
        {
            "IsPrivateHost": false,
            "ID": 1792,
            "HostPurposes": [
                0,
                1,
                2
            ],
            "Status": 0,
            "Description": "created by automation",
            "Source": "Local",
            "Pools": [
                1000
            ],
            "Name": "MY_SERVER_URL",
            "Installation": 0,
            "Location": "Default",
            "MIListener": "None",
            "Attributes": [],
            "Priority": 5,
            "SslEnabled": false,
            "Ipv6Enabled": false,
            "Domain": null,
            "UserName": null
        },
        {
            "IsPrivateHost": false,
            "ID": 1794,
            "HostPurposes": [
                1
            ],
            "Status": 0,
            "Description": "created by automation",
            "Source": "Local",
            "Pools": [
                1000
            ],
            "Name": "MY_SERVER_URL",
            "Installation": 1,
            "Location": "Default",
            "MIListener": "None",
            "Attributes": [],
            "Priority": 7,
            "SslEnabled": false,
            "Ipv6Enabled": false,
            "Domain": null,
            "UserName": null
        }
    ]

See also:

- Add a host
- Get or delete a host by ID

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)