Create or get all timeslots

Available in versions: 12.56 and later

Description

Adds a timeslot or retrieves a list of existing timeslots.

URL

Copy code
/LoadTest/rest/domains/{domainName}/projects/{projectName}/timeslots

Remarks

Body of the request should contain a resource folder description in XML or JSON format.

HTTP method

  • POST: Creates a timeslot.

  • GET: Returns the timeslots in the body of the response.

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:

  • GET: No request body.

  • POST: An XML or JSON containing the timeslot reservation.

    Fields that can be used in the request body during timeslot creation:

    ElementDescription
    StartTimeThe UTC date and time (in hours and minutes) that the timeslot starts.
    DurationInMinutesThe duration of the timeslot (in minutes).
    DescriptionA description of the timeslot.
    NameName of the timeslot.
    Demands

    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)

    VusersNumberThe number of Vusers requested for the timeslot.
    VudsNumberThe number of VUFDs that are defined in the linked test.
    PostRunActionThe action to be taken when the test run is complete. The post-run action can be: DoNothing, CollateOnly, or CollateAnalyze.
    LoadTestInstanceID Enables you to link a performance test instance to the timeslot.
    IsTestAutostart The linked tests or test sets automatically start running at the start of the timeslot, without any manual intervention (true/false).

Request examples:

Copy code
Request example - GET:
GET http://<LRE_Server>/LoadTest/rest/domains/MyDomain/projects/MyProject/timeslots
Copy code
Request example - POST:
POST http://<LRE_Server>/LoadTest/rest/domains/{domainName}/projects/{projectName}/timeslots
Content-Type: application/xml
Cookie: LWSSO_COOKIE_KEY={LwssoCookie};
Copy code
POST example - Request using Content-Type header application/xml:
<Timeslot xmlns="http://www.hp.com/PC/REST/API">
    <StartTime>2024-04-12T20:00:00Z</StartTime>
    <DurationInMinutes>30</DurationInMinutes>
    <Description>add text</Description>
    <Name>My_Timeslot</Name>
      <Demands>
        <ControllerDemandManual>
           <HostID>1100</HostID>
       </ControllerDemandManual>
        <LoadGeneratorDemandManual>
           <HostID>1809</HostID>
       </LoadGeneratorDemandManual>
    </Demands>
    <IsTestAutostart>false</IsTestAutostart>
</Timeslot>
Copy code
POST example - Request when a load test is linked to the timeslot (demands are automatically added to the timeslot based on the load test data):
<Timeslot xmlns="http://www.hp.com/PC/REST/API">
    <StartTime>2017-09-05T22:30:00Z</StartTime>    
    <DurationInMinutes>30</DurationInMinutes>
    <LoadTestInstanceID>1</LoadTestInstanceID>
    <PostRunAction>CollateAnalyze</PostRunAction>
    <Description>add text</Description>
</Timeslot>        

Examples of the response:

Copy code
XML response example:
<Timeslot> 
    <Name />  
    <VusersNumber>0</VusersNumber>
    <PostRunAction>CollateAnalyze</PostRunAction>
    <StartTime>2017-09-05T22:30:00+00</StartTime>
       <IsTestAutostart>false</IsTestAutostart> 
       <LoadTestInstanceID>1</LoadTestInstanceID>
    <DurationInMinutes>30</DurationInMinutes>
    <Description />
    <AllocatedDemands> 
       <ControllerDemand> 
          <ID>1361</ID>
          <Type>Manual</Type> 
          <RequestedAmount>1</RequestedAmount>
          <AllocatedAmount>1</AllocatedAmount> 
          <FilterString>my12365.lab.net</FilterString>
          <AllocatedHostID>1001</AllocatedHostID>  
          <AllocatedHostName>my12365.lab.net</AllocatedHostName> 
          <IsLoadGenerator>false</IsLoadGenerator>
       </ControllerDemand> 
       <LoadGeneratorDemand>  
          <ID>1362</ID>
          <Type>Manual</Type> 
          <RequestedAmount>1</RequestedAmount>
          <AllocatedAmount>1</AllocatedAmount> 
          <FilterString>my12366.lab.net</FilterString>   
          <AllocatedHostIDs>  
             <HostID>1002</HostID> 
          </AllocatedHostIDs>  
          <AllocatedHostNames> 
             <AllocatedHostName>my12366.lab.net</AllocatedHostName>  
          </AllocatedHostNames> 
        </LoadGeneratorDemand>
    </AllocatedDemands>  
    <ID>1122</ID>
    <LoadTestID>3</LoadTestID>
    <LoadTestName>test_300</LoadTestName>
    <EndTime>2017-09-05T23:00:00+00</EndTime>
    <CreatedBy>sa</CreatedBy> 
    <CreationDate>2017-09-05T08:46:51+00</CreationDate> 
    <CurrentRunState>Not Started</CurrentRunState>
    <IsAdHoc>false</IsAdHoc> 
    <IsAllocated>true</IsAllocated> 
    <FailureDescription />
    <OpenStatus>Future</OpenStatus> 
    <ProjectID>2</ProjectID>  
</Timeslot>        
Copy code
JSON response example:
{
    "AllocatedDemands": null,
    "ID": 1091,
    "LoadTestID": 176,
    "LoadTestName": "e2e_test",
    "EndTime": "2024-04-12T21:00:00+00",
    "CreatedBy": "sa",
    "CreationDate": "2024-04-12T05:47:39+00",
    "CurrentRunState": null,
    "IsAdHoc": false,
    "IsAllocated": true,
    "FailureDescription": {
        "FailureReasons": null
    },
    "OpenStatus": "Future",
    "ProjectID": 22,
    "Name": null,
    "VusersNumber": 2,
    "PostRunAction": 2,
    "StartTime": "2024-04-12T20:30:00+00",
    "DurationInMinutes": 30,
    "IsTestAutostart": false,
    "LoadTestInstanceID": 8,
    "Description": "add text"
}

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. See Timeslot XML.

Response examples:

Copy code
XML example:
<Timeslots>
  <Timeslot> 
    <Name>MyTimeslot</Name> 
    <VusersNumber>0</VusersNumber>
    <PostRunAction>DoNothing</PostRunAction>
    <StartTime>2017-09-04T22:30:00+00</StartTime>
    <DurationInMinutes>30</DurationInMinutes>
    <IsTestAutostart>false</IsTestAutostart> 
    <LoadTestInstanceID>1</LoadTestInstanceID>
    <ID>1118</ID>      
    <LoadTestID>3</LoadTestID>
    <LoadTestName>test_300</LoadTestName>
    <EndTime>2017-09-04T23:00:00+00</EndTime>
    <CreatedBy>sa</CreatedBy> 
    <CreationDate>2017-09-04T11:30:41+00</CreationDate> 
    <CurrentRunState>Not Started</CurrentRunState>
    <Description /> 
    <IsAdHoc>false</IsAdHoc> 
    <IsAllocated>true</IsAllocated>  
    <OpenStatus>Closed</OpenStatus> 
    <ProjectID>2</ProjectID>  
  </Timeslot>
  <Timeslot> 
    <Name /> 
    <VusersNumber>0</VusersNumber> 
    <VudsNumber>0</VudsNumber>
    <PostRunAction>DoNothing</PostRunAction>
    <StartTime>2017-09-04T20:00:00+00</StartTime>
    <DurationInMinutes>30</DurationInMinutes>
    <IsTestAutostart>false</IsTestAutostart>   
    <ID>1119</ID>      
    <LoadTestName />
    <EndTime>2017-09-04T20:30:00+00</EndTime>
    <CreatedBy>sa</CreatedBy> 
    <CreationDate>2017-09-04T12:02:13+00</CreationDate> 
    <CurrentRunState>None</CurrentRunState>
    <Description /> 
    <IsAdHoc>false</IsAdHoc> 
    <IsAllocated>true</IsAllocated>  
    <OpenStatus>Closed</OpenStatus> 
    <ProjectID>3</ProjectID>  
  </Timeslot>    
</Timeslots>    
Copy code
JSON example:
[
    {
        "AllocatedDemands": null,
        "ID": 1090,
        "LoadTestID": 176,
        "LoadTestName": "e2e_test",
        "EndTime": "2024-04-12T23:00:00+00",
        "CreatedBy": "sa",
        "CreationDate": "2024-04-12T05:47:09+00",
        "CurrentRunState": "",
        "IsAdHoc": false,
        "IsAllocated": true,
        "FailureDescription": null,
        "OpenStatus": "Future",
        "ProjectID": 22,
        "Name": null,
        "VusersNumber": 2,
        "PostRunAction": 2,
        "StartTime": "2024-04-12T22:30:00+00",
        "DurationInMinutes": 30,
        "IsTestAutostart": false,
        "LoadTestInstanceID": 8,
        "Description": "add text"
    },
    {
        "AllocatedDemands": null,
        "ID": 1089,
        "LoadTestName": null,
        "EndTime": "2024-04-12T20:30:00+00",
        "CreatedBy": "sa",
        "CreationDate": "2024-04-12T05:26:13+00",
        "CurrentRunState": "",
        "IsAdHoc": false,
        "IsAllocated": true,
        "FailureDescription": null,
        "OpenStatus": "Future",
        "ProjectID": 22,
        "Name": "My_Timeslot",
        "VusersNumber": 0,
        "PostRunAction": 0,
        "StartTime": "2024-04-12T20:00:00+00",
        "DurationInMinutes": 30,
        "IsTestAutostart": false,
        "LoadTestInstanceID": -1,
        "Description": "add text"
    }
]

See also: