Open topic with navigation

# Timeslots (Check availability)

Available in versions: 12.56 and later

## Description

Checks if a timeslot can be allocated.

## URL

    /LoadTest/rest/domains/{domainName}/projects/{projectName}/timeslots/availabilities

## Remarks

Body of the request should contain a timeslot description in xml format.

## HTTP Method

PUT: Checks timeslot availability.

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

PUT: An XML describing the timeslot to be verified.

Fields that can be used in the request body for checking timeslot availability:

Element | Description
--- | ---
SearchDurationInHours | (Optional) Default value is 42 hours.
Timeslot | The type of demands for timeslot creation. Can include: ControllerDemandManual. Fields include: HostID (mandatory), IsLoadGenerator (optional) ControllerDemandAutomatic. Contains no fields; any host can be allocated as a Controller. LoadGeneratorDemandManual. Fields: HostID (mandatory) LoadGeneratorDemandAutomatic. Fields: HostsToReserve (mandatory), LocationID (optional)

Request Example

    PUT /LoadTest/rest/domains/DEFAULT/projects/MyProject/timeslots/availabilities HTTP/1.1
    Host: PCServer
    Content-Type: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

An example of checking a four hour time interval with already allocated timeslots:

    <TimeslotAvailability xmlns="http://www.hp.com/PC/REST/API">
      <SearchDurationInHours>4</SearchDurationInHours>
      <Timeslot>
          <StartTime>2017-09-05T12:00:00Z</StartTime>
          <DurationInMinutes>30</DurationInMinutes>
          <Description>checking availability</Description>
          <Demands>
            <ControllerDemandManual>
               <HostID>1001</HostID>
            </ControllerDemandManual>
            <LoadGeneratorDemandAutomatic>
               <HostsToReserve>1</HostsToReserve>
            </LoadGeneratorDemandAutomatic>
          </Demands>
      </Timeslot>
    </TimeslotAvailability>

## Response

Headers:

One of:

- Content-Type: application/xml
- Content-Type: application/json

Cookies:

None

HTML Return Code:

One of the HTTP Return Codes

HTML Body:

The response body contains a list of conflicts that the timeslot could encounter during the selected search interval. If the list is empty, the timeslot can be allocated at any time within the search interval.

Response Example

The response body example for the above request (checking a four hour time interval with already allocated timeslots):

    <TimeslotAvailability>
       <Conflicts>
          <Conflict>
             <StartTime>2017-09-05T12:00:00+00</StartTime>
    	  <ConflictReasons>
    	    <ConflictReason>Number of concurrent runs has reached the project limit (1).</ConflictReason>
    	    <ConflictReason>Number of concurrent runs has reached the LoadRunner Enterprise license limit (1).</ConflictReason>
    	    <ConflictReason>The following host(s) are already in use: myd12365.lab.net</ConflictReason>
    	  </ConflictReasons>
          </Conflict>
          <Conflict>
             <StartTime>2017-09-05T12:15:00+00</StartTime>
    	  <ConflictReasons>
    	    <ConflictReason>Number of concurrent runs has reached the project limit (1).</ConflictReason>
    	    <ConflictReason>Number of concurrent runs has reached the LoadRunner Enterprise license limit (1).</ConflictReason>
    	    <ConflictReason>The following host(s) are already in use: myd12365.lab.net</ConflictReason>
    	  </ConflictReasons>
          </Conflict>
      </Conflicts>
    </TimeslotAvailability>

## See Also

Timeslots (Create, Get all timeslots)
Timeslots (Delete a timeslot)
Timeslot XML