Open topic with navigation

# Test Plan (Create, Get all folders)

## Description

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

## URL

    /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

    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

    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

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

    <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

Test Plan (Delete test plan folder)
Test Plan (Update test plan folder name)