Create or get all folders in a test plan

Description

Adds a new test plan folder or retrieves a list of existing test plan folders.

URL

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

Remarks

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

HTTP method

  • POST: Creates a test plan folder.

  • GET: Returns a list of all test plan folders 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:

  • POST: XML or JSON containing the path and name of the new folder. The fields in the request are listed below.

    ElementDescription
    Name

    Under which folder the new folder should be created.

    Path

    Name of the new folder.

  • GET: No request body.

Request examples:

Copy code
XML example - GET:
GET http://<LRE_Server>/LoadTest/rest/domains/MyDomain/projects/MyProject/testplan
Copy code
XML example - POST:
POST http://<LRE_Server>/LoadTest/rest/domains/MyDomain/projects/MyProject/testplan 
Content-Type: application/xml
Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

<TestPlanFolder xmlns="http://www.hp.com/PC/REST/API">
   <Path>Subject\MyTests\REST-Folder</Path>
   <Name>Test3</Name>
</TestPlanFolder>
Copy code
JSON example - POST:
POST http://<LRE_Server>/LoadTest/rest/domains/MyDomain/projects/MyProject/testplan 
Content-Type: application/json
Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

{    "Path": "Subject\\MyTests\\REST-Folder",
     "Name": "Test1"
}

Response

Headers:

One of:

  • Accept: application/xml

  • Accept: application/json

Cookies:

None

HTML return code:

One of the HTTP return codes

HTML body:

The fields in the response are:

ElementDescription
Id

Unique numeric identifier.

ParentId

The Id of the parent folder.

Name

Folder name.

FullPath

The full path of the folder, including the root (usually 'Subject') and the folder itself.

Response examples:

Copy code
XML example - GET:
<TestPlanFolders xmlns="http://www.hp.com/PC/REST/API">
  <TestPlanFolder>
    <Id>1006</Id>
    <ParentId>1001</ParentId>
    <Name>REST-Folder</Name>
    <FullPath>Subject\MyTests\REST-Folder</FullPath>
    </TestPlanFolder>
  <TestPlanFolder>
    <Id>1001</Id>
    <ParentId>2</ParentId>
    <Name>MyTests</Name>
    <FullPath>Subject\MyTests</FullPath>
    </TestPlanFolder>
  <TestPlanFolder>
    <Id>2</Id>
    <ParentId>0</ParentId>
    <Name>Subject</Name>
    <FullPath>Subject</FullPath>
    </TestPlanFolder>
</TestPlanFolders>
Copy code
JSON example - GET:
[
    {
        "Id": 2,
        "ParentId": 0,
        "Name": "Subject",
        "FullPath": "Subject"
    },
    {
        "Id": 1026,
        "ParentId": 2,
        "Name": "e2e_25-03-2024-11-25-28-PM",
        "FullPath": "Subject\\e2e_25-03-2024-11-25-28-PM"
    },
    {
        "Id": 1027,
        "ParentId": 1026,
        "Name": "level2",
        "FullPath": "Subject\\e2e_25-03-2024-11-25-28-PM\\level2"
    },
]
Copy code
XML example - POST (StatusCode 201 - Created):
<TestPlanFolder xmlns="http://www.hp.com/PC/REST/API">
   <Id>1017</Id>
   <ParentId>1006</ParentId>
   <Name>Test3</Name>
   <FullPath>Subject\MyTests\REST-Folder\Test3</FullPath>
 </TestPlanFolder>
Copy code
JSON example - POST (StatusCode 201 - Created):
{   
     "Id": 1034,
     "ParentId": 2,
     "Name": "Test1",
     "FullPath": "Subject\\Test1"
}

See also: