Hello,
I have a question regarding the api:
GET /project/{ws-id}/tree/{parent:.*}
When I call the above api on some folder, I've noticed that only the folders hierarchy is returned in the response, however all
files are missing from the response.
e.g. if I have the following tree structure:
define(function(){
return {
"name"
: "testDataRoot",
"type"
: "folder",
"content"
: [
{
"name"
: "folder00_00",
"type"
: "folder",
"content"
: [
{
"name"
: "folder00_00_00",
"type"
: "folder",
"content"
: [ {
"name"
: "file00_00_00_00",
"type"
: "file",
"content"
: "Sample Content1"
}, {
"name"
: "file00_00_00_01",
"type"
: "file",
"content"
: "Sample Content2"
}, {
"name"
: "file00_00_00_02",
"type"
: "file",
"content"
: "Sample Content3"
}, {
"name"
: "file00_00_00_03",
"type"
: "file",
"content"
: "Sample Content4"
} ]
},
{
"name"
: "folder00_00_01",
"type"
: "folder",
"content"
: []
},
{
"name"
: "folder00_00_02",
"type"
: "folder",
"content"
: []
}
]
},
{
"name"
: "folder00_01",
"type"
: "folder",
"content"
: [
{
"name"
: "folder00_01_00",
"type"
: "folder",
"content"
: [ {
"name"
: "file00_00_01_00_01.html",
"type"
: "file",
"content"
: "Sample Content5"
}, {
"name"
: "file00_00_01_00_02",
"type"
: "file",
"content"
: "Sample Content6"
} ]
},
{
"name"
: "folder00_01_01",
"type"
: "folder",
"content"
: []
}
]
}
]
};
});
and I send the following request:
localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot?depth=1000
I get the below response (as you can see only folder items are returned but all files are missing).
Is it the expected behavior? If so, how can I get a folder's full tree hierarchy of sub-folders
and files?
If there is no such api, can we consider an extension to the /tree api as a contribution perhaps?
Thanks in advance,
Anat
Response:
{
"node": {
"name": "testDataRoot",
"type": "folder",
"path": "/TestProject_1431527934597_12/testDataRoot",
"attributes": {},
"contentLength": 0,
"modified": 1431527940583,
"created": -1,
"mediaType": "text/directory",
"links": [
{
"method": "GET",
"parameters": [],
"produces": "application/zip",
"rel": "zipball sources",
"href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "children",
"href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "tree",
"href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "modules",
"href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot"
},
{
"method": "DELETE",
"parameters": [],
"rel": "delete",
"href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot"
}
]
},
"children": [
{
"node": {
"name": "folder00_00",
"type": "folder",
"path": "/TestProject_1431527934597_12/testDataRoot/folder00_00",
"attributes": {},
"contentLength": 0,
"modified": 1431527940628,
"created": -1,
"mediaType": "text/directory",
"links": [
{
"method": "GET",
"parameters": [],
"produces": "application/zip",
"rel": "zipball sources",
"href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "children",
"href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "tree",
"href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "modules",
"href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_00"
},
{
"method": "DELETE",
"parameters": [],
"rel": "delete",
"href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_00"
}
]
},
"children": [
{
"node": {
"name": "folder00_00_00",
"type": "folder",
"path": "/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00",
"attributes": {},
"contentLength": 0,
"modified": 1431527940670,
"created": -1,
"mediaType": "text/directory",
"links": [
{
"method": "GET",
"parameters": [],
"produces": "application/zip",
"rel": "zipball sources",
"href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "children",
"href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "tree",
"href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "modules",
"href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"
},
{
"method": "DELETE",
"parameters": [],
"rel": "delete",
"href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"
}
]
},
"children": []
},
{
"node": {
"name": "folder00_00_01",
"type": "folder",
"path": "/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01",
"attributes": {},
"contentLength": 0,
"modified": 1431527940627,
"created": -1,
"mediaType": "text/directory",
"links": [
{
"method": "GET",
"parameters": [],
"produces": "application/zip",
"rel": "zipball sources",
"href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "children",
"href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "tree",
"href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "modules",
"href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"
},
{
"method": "DELETE",
"parameters": [],
"rel": "delete",
"href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"
}
]
},
"children": []
},
{
"node": {
"name": "folder00_00_02",
"type": "folder",
"path": "/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02",
"attributes": {},
"contentLength": 0,
"modified": 1431527940623,
"created": -1,
"mediaType": "text/directory",
"links": [
{
"method": "GET",
"parameters": [],
"produces": "application/zip",
"rel": "zipball sources",
"href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "children",
"href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "tree",
"href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "modules",
"href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"
},
{
"method": "DELETE",
"parameters": [],
"rel": "delete",
"href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"
}
]
},
"children": []
}
]
},
{
"node": {
"name": "folder00_01",
"type": "folder",
"path": "/TestProject_1431527934597_12/testDataRoot/folder00_01",
"attributes": {},
"contentLength": 0,
"modified": 1431527940605,
"created": -1,
"mediaType": "text/directory",
"links": [
{
"method": "GET",
"parameters": [],
"produces": "application/zip",
"rel": "zipball sources",
"href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "children",
"href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "tree",
"href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "modules",
"href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_01"
},
{
"method": "DELETE",
"parameters": [],
"rel": "delete",
"href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_01"
}
]
},
"children": [
{
"node": {
"name": "folder00_01_00",
"type": "folder",
"path": "/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00",
"attributes": {},
"contentLength": 0,
"modified": 1431527940650,
"created": -1,
"mediaType": "text/directory",
"links": [
{
"method": "GET",
"parameters": [],
"produces": "application/zip",
"rel": "zipball sources",
"href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "children",
"href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "tree",
"href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "modules",
"href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"
},
{
"method": "DELETE",
"parameters": [],
"rel": "delete",
"href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"
}
]
},
"children": []
},
{
"node": {
"name": "folder00_01_01",
"type": "folder",
"path": "/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01",
"attributes": {},
"contentLength": 0,
"modified": 1431527940605,
"created": -1,
"mediaType": "text/directory",
"links": [
{
"method": "GET",
"parameters": [],
"produces": "application/zip",
"rel": "zipball sources",
"href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "children",
"href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "tree",
"href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"
},
{
"method": "GET",
"parameters": [],
"produces": "application/json",
"rel": "modules",
"href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"
},
{
"method": "DELETE",
"parameters": [],
"rel": "delete",
"href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"
}
]
},
"children": []
}
]
}
]
}