Open topic with navigation

# Get Hosts List by Query

## Description

Returns a list of hosts by query (filter).

## URL

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

Where:

    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

    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

    <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

hosts
hosts/{hostID}