Open topic with navigation

# Get Run by Query

## Description

Returns a list of runs by query (filter).

## URL

    /Admin/rest/v1/runs?query={<QUERY_NAME>["<YOUR_QUERY_VALUE>"]}

## Runs Query Values

QUERY_NAME options

-     ID

-     RunID

-     Domain;Project  (filtering by Domain or Project requires both Domain and Project)

-     Name

-     StartDate

-     EndDate

-     Duration

-     UserName

-     ControllerName

-     State

-     PCVUsersMax

-     PCVUsersAvg

-     InvolvedVusers

-     TimeslotID

## Remarks

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

## HTTP Method

GET: Returns a list of runs by query.

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

None

Example request for all runs that belong to a test with ID = 1

    GET http://<LRE_Server>/Admin/rest/v1/runs?query={TestID[1]}
    Content-Type: application/xml
    Accept: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Example request for all runs with ID between 1030 - 1035, and project run ID = 32

    GET http://<LRE_Server>/Admin/rest/v1/runs?query={ID[>1030];ID[<1035];RunID[32]}
    Content-Type: application/xml
    Accept: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Example request for all runs sorted by ID in descending order so that only the ID field is retrieved

    GET http://<LRE_Server>/Admin/rest/v1/runs?fields=ID&order-by={ID[DESC]}
    Content-Type: application/xml
    Accept: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Example of the resulting response:

    <LabRuns>
       <LabRun>
         <ID>1042</ID>
       </LabRun>
       <LabRun>
         <ID>1041</ID>
       </LabRun>
       <LabRun>
         <ID>1040</ID>
       </LabRun>
    </LabRuns>

Example request for all runs sorted by ID in ascending order so that only the ID and project fields are retrieved

    GET http://<LRE_Server>/Admin/rest/v1/runs?fields=ID,Project&order-by={ID[ASC]}
    Content-Type: application/xml
    Accept: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Example of the resulting response:

    <LabRuns>
       <LabRun>
         <ID>1013</ID>
         <Project>INST_PATCH</Project>
       </LabRun>
       <LabRun>
         <ID>1014</ID>
         <Project>INST_PATCH</Project>
       </LabRun>
    </LabRuns>

Example request for all runs with start date greater than a given value sorted by ID in ascending order, so that only ID and start date fields are retrieved

    GET http://<LRE_Server>/Admin/rest/v1/runs?query={StartDate[>'2017-02-01%2014:17:17']}&fields=ID,StartDate&order-by={ID[ASC]}
    Content-Type: application/xml
    Accept: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

Example of the resulting response:

    <LabRuns>
       <LabRun>
         <ID>1014</ID>
         <StartDate>2017-02-01 14:27:15</StartDate>
       </LabRun>
       <LabRun>
         <ID>1017</ID>
         <StartDate>2017-02-01 15:13:13</StartDate>
       </LabRun>
    </LabRuns>

Example request for all runs from the given domain and project

    GET http://<LRE_Server>/Admin/rest/v1/runs?query={Domain[DEFAULT];Project[INST_PATCH]}
    Content-Type: application/xml
    Accept: 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 run response.

## See Also

Get all runs
Get Run by Query