Application Programming Interface Guide > REST API > TDV Server REST APIs > Folders
 
Folders
The folder API provides the ability to create, alter or delete multiple folders and read a folder.
GET/folder
PUT/folder
POST/folder
DELETE/folder
DELETE/folder/{folderPath}
GET/folder
This API is used to get folder.
Parameters:
Name
Description
Parameter Type
Data Type
path
folder path
query
string
summary
fetch folder summary
query
boolean
Example to Get summary of folder "/shared/examples/folder1"
curl -X GET -u admin:admin "http://localhost:9400/rest/folder/v1?path=%2Fshared%2Fexamples%2Ffolder1&summary=true" -H "Content-Type:application/json"
Example to Get summary and detailed information of folder "/shared/examples/folder1"
curl -X GET -u admin:admin "http://localhost:9400/rest/folder/v1?path=%2Fshared%2Fexamples%2Ffolder1" -H "Content-Type:application/json"
PUT/folder
This API is used to update folders.
Parameters:
None.
Request Body
Example Value - Schema
[
{
"parentPath": "string",
"name": "string",
"properties": {
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
},
"annotation": "string",
"newPath": "string",
"ifNotExists": true
}
]
Example to Update folder with a modified annotation "/shared/examples/folder1"
curl -X PUT -u admin:admin "http://localhost:9400/rest/folder/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"folder1\", \"annotation\":\"Edited annotation of a folder created using REST api\" }]"
Example to Rename folder "/shared/examples/folder1" to "/shared/examples/folder2"
curl -X PUT -u admin:admin "http://localhost:9400/rest/folder/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"folder1\", \"newPath\":\"/shared/examples/folder2\" }]"
Example to Relocate & Rename folder "/shared/examples/folder1" to "/users/composite/admin/folder2"
curl -X PUT -u admin:admin "http://localhost:9400/rest/folder/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"folder1\", \"newPath\":\"/users/composite/admin/folder2\" }]"
Example to Unset annotation on folder "/shared/examples/folder1"
curl -X PUT -u admin:admin "http://localhost:9400/rest/folder/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"folder1\", \"annotation\":\"null\" }]"
POST/folder
This API is used to Create folders using specified paths.
Parameters:
None.
Request Body
Example Value - Schema
[
{
"parentPath": "string",
"name": "string",
"properties": {
"additionalProp1": {},
"additionalProp2": {},
"additionalProp3": {}
},
"annotation": "string",
"newPath": "string",
"ifNotExists": true
}
]
Example to Create folder "/shared/examples/folder1"
curl -X POST -u admin:admin "http://localhost:9400/rest/folder/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\":\"folder1\", \"annotation\":\"This folder is created using REST api\"}]"
Example to Create folder "/shared/examples/folder1" with "ifNotExists" syntax
curl -X POST -u admin:admin "http://localhost:9400/rest/folder/v1" -H "Content-Type:application/json" -d "[{\"parentPath\":\"/shared/examples\", \"name\" : \"folder1\", \"ifNotExists\":true, \"annotation\":\"This is a folder created using REST api\" }]"
DELETE/folder
This API is used to delete folders.
Parameters:
 
Name
Description
Parameter Type
Data Type
ifExists
flag to indicate whether a folder exists
query
boolean
Request Body
Example Value - Schema
[
"string"
]
Example to Delete folder "/shared/examples/folder1"
curl -X DELETE -u admin:admin "http://localhost:9400/rest/folder/v1" -H "Content-Type:application/json" -d "[\"/shared/examples/folder1\"]"
Sample CURL Invocation with "ifExists":
curl -X DELETE -u admin:admin "http://localhost:9400/rest/folder/v1" -H "Content-Type:application/json" -d "[\"/shared/examples/folder1\"]"
DELETE/folder/{folderPath}
This API is used to delete folder in the path. Delete folder. Optionally specify "if exists".
Parameters:
 
Name
Description
Parameter Type
Data Type
folderPath
Path of the folder
query
string
ifExists
flag to indicate whether a folder exists
query
boolean
Example to Delete folder.
curl -X DELETE -u admin:admin "http://localhost:9400/rest/folder/v1/{folderPath}?ifExists=true" -H "Content-Type: application/json"
Sample CURL Invocation with "ifExists":
curl -X DELETE -u admin:admin "http://localhost:9400/rest/folder/v1/%2Fshared%2Fexamples%2Ffolder1?ifExists=true" -H "Content-Type:application/json"