Share this page

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

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

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:

POST: An XML containing the path and name of the new folder.

The fields in the request are:

Element | Description
--- | ---
Name | Under which folder the new folder should be created.
Path | Name of the new folder.

GET: No request body.

Request Example - POST
Copy code

    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>

Request Example - GET
Copy code

    GET http://<LRE_Server>/LoadTest/rest/domains/MyDomain/projects/MyProject/testplan

## 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 fields in the response are:

Element | Description
--- | ---
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 Example - GET
Copy code

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

Response Example - POST

StatusCode 201 - Created.

Copy code

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

## See Also

Delete test plan folder
Update test plan folder name

Tips to improve your search results... LoadRunner Enterprise REST API Reference LRE REST API All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic(Undefined variable: _rscC_Basic_Variables.VersionLabel)