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

-     runtime-state

-     purpose

-     priority

-     source

## Remarks

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

## HTTP Method

GET: Returns a list of hosts by query.

## Request

Headers:

Content-Type: application/xml

Cookies:

Version 2020 (or later) | LWSSO_COOKIE_KEY={LwssoCookie};
Versions earlier than 2020 | LWSSO_COOKIE_KEY={LwssoCookie};QCSession={QCSessionCookie};

Request Body:

None

Request Example
Copy code

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

## Response

Headers:

Content-Type: application/xml

Cookies:

None

HTML Return Code:

One of the HTTP Return Codes

HTML Body:

GET: Returns the data on the entity in the response. See hosts XML

Response Example
Copy code

    <Hosts>
       <Host>
          <Name>myd-vm01062</Name>
          <Installation>WindowsHost</Installation>
          <HostPurposes>
             <HostPurpose>Controller</HostPurpose>
             <HostPurpose>DataProcessor</HostPurpose>
             <HostPurpose>LoadGenerator</HostPurpose>
          </HostPurposes>
          <Status>Operational</Status>
          <Location>Default</Location>
          <MIListener>None</MIListener>
          </Attributes />
          <Priority>5</Priority>
          <SslEnabled>false</SslEnabled>
          <ID>1006</ID>
       </Host>
       <Host>
          <Name>myd-vm01135</Name>
          <Installation>WindowsHost</Installation>
          <HostPurposes>
             <HostPurpose>Controller</HostPurpose>
             <HostPurpose>DataProcessor</HostPurpose>
             <HostPurpose>LoadGenerator</HostPurpose>
          </HostPurposes>
          <Status>Operational</Status>
          <Location>Default</Location>
          <MIListener>None</MIListener>
          </Attributes />
          <Priority>5</Priority>
          <SslEnabled>false</SslEnabled>
          <ID>1076</ID>
       </Host>
    </Hosts>

## See Also

Add a host
Get or delete a host by ID

Tips to improve your search results... LoadRunner Enterprise REST API Reference LRE REST API All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic(Undefined variable: _rscC_Basic_Variables.VersionLabel)