Create Folder Hierarchy 

Description

The 'Create Folder Hierarchy' endpoint is used to create folder(s) with specific hierarchical structure in Leapwork. To create a folder hierarchy, enter folder titles one after another separated by '/' symbol. After successful creation of a folder, the endpoint returns a HierarchyItemId. This is the hierarchy item id in which the folder hierarchy is going to be created. 

The ItemId parameter is the item id of a pre-existing Flow or Folder under which the new Item needs to be added. If the itemId is null or empty, the folder hierarchy will be created in the root folder.

 

Please note that hierarchies such as “..folder1/folder2/” and “..folder1//folder2“ are not allowed.

Request URL

http://{controllerMachine}:{controllerPort}/api/v4/hierarchy/create/folder/{itemId}

Input parameters

Field Type Description Comments
itemId string Unique identifier for Items in the Asset hierarchy The itemId can be from the following types of items:
- 'Folder'
- 'Flow'
- 'SubFlow'

Examples

Curl

curl -X PUT --header 'Accept: application/json' --header 'AccessKey: Mo87Nc4qDAtzJNDb' 'http://{controllerMachine}:{controllerPort}/api/v4/hierarchy/create/folder/{itemId}'

PowerShell 

$headers = @{}
$headers.Add("AccessKey","123qwe")
Invoke-WebRequest -Uri "http://autobotvm001:9001/api/v4/hierarchy/create/folder?folder=Project1/Feature1" -ContentType "application/json" -Headers $headers -Method PUT 

Response Body

List of Variables

[
   {

     "$id": "1",

     "HierarchyItemId": "4fa4d1c3-cf08-40b3-861e-d88253458255"

    }
]

 

Response Object

Field Type Description Values
$id string ID of internal item (Folder/ Flow/Element etc.)  
HierarchyItemId string HierarchyItemId is Id of newly created Folder in the hierarchy.  


Response Code

200 (OK)

401 (Unauthorized, incorrect access key)

400 (Incorrect parameter 'folder' key or its value)

409 (API Returns 409 error, If ItemId cannot create folder or ItemId already contains folder item with the same title or ItemId already contains same hierarchy)

500 (Internal Server Error)