我认为您有不同的选择。超过我将描述的三个。我更喜欢前两个。
1) 实现自己的网页脚本
这样做的好处是您可以准确地决定要返回什么以及如何在文件夹结构中导航。做你需要的就是一个用 javascript 和免费标记模板编写的简单 webscript。或者,如果您愿意,也可以使用 Java。
Repository-tier web scripts
2) 使用 CMIS
如果您不想编写 webscript,因为没有 OOTB REST API 可以完全满足您的需求,使用 CMIS 可能会更容易。
您需要做的事情可以通过 cmis 查询轻松实现。
作为起点:CMIS tutorials 和 CMIS Documentation
3) 使用可用的 REST API
您可以使用多种 API。找到它们的最简单方法是按照已经建议的方式访问 /alfresco/service/index。
Wiki - Alfresco API
要获取所有孩子,您可以使用例如:
http://<your-alfresco-server>/alfresco/service/api/forms/picker/node/workspace/SpacesStore/62ccab8f-20bc-4039-9b59-70e4192fbeb6/doclib
这会返回例如(仅响应的一个 sn-p):
{
"data":
{
"parent":
{
"type": "cm:folder",
"isContainer": true,
"name": "Company Home",
"title": "Company Home",
"description": "The company root space",
"modified": "2015-11-24T01:13:48.132Z",
"modifier": "System",
"displayPath": "",
"nodeRef": "workspace://SpacesStore/3e49a3f3-54e8-427c-a7e6-33eedf3cb479"
},
"items":
[
{
"type": "cm:folder",
"parentType": "cm:cmobject",
"isContainer": true,
"name": "Container Bank",
"title": "Container Bank",
"description": "Bank of Deal Container Folders",
"modified": "2015-11-24T01:13:44.827Z",
"modifier": "System",
"displayPath": "\/Company Home",
"nodeRef": "workspace://SpacesStore/09b3072a-e76d-427c-8465-e18a009279c8",
"selectable" : true
},
{
"type": "cm:folder",
"parentType": "cm:cmobject",
"isContainer": true,
"name": "Data Dictionary",
"title": "Data Dictionary",
"description": "User managed definitions",
"modified": "2015-11-26T22:40:27.078Z",
"modifier": "System",
"displayPath": "\/Company Home",
"nodeRef": "workspace://SpacesStore/b6653365-0c1c-4fa7-a604-0ac302d2374a",
"selectable" : true
},
.....
]
}
}
此网页脚本还有其他有用的参数。如果您想在工作中查看它,可以打开“对象查找器”(例如尝试将文档附加到工作流程)。浏览存储库的弹出窗口将调用此 webscript。例如,在我的例子中,它执行了以下调用:
curl "http://192.168.64.150:8080/share/proxy/alfresco/api/forms/picker/node/workspace/SpacesStore/66704925-4b32-4c4c-953b-42c6f0f047ec/children?selectableType=cm:content&searchTerm=&size=1000&filterStatusGroups=null" -H "Cookie: JSESSIONID=D9D08EC75879F4807AFF0FF115702E07; alfLogin=1452880051; alfUsername3=admin" -H "Accept-Encoding: gzip, deflate, sdch" -H "Accept-Language: en-US,en;q=0.8,it;q=0.6,en-GB;q=0.4" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36" -H "Accept: */*" -H "Referer: http://192.168.64.150:8080/share/page/site/evergreeen-entertainment-ltd/start-workflow" -H "X-Requested-With: application/x-www-form-urlencoded" -H "Connection: keep-alive" --compressed
要获取节点的所有版本,例如,您可以使用以下命令:
http://192.168.64.150:8080/alfresco/service/api/node/workspace/SpacesStore/687858da-c713-4739-8a3c-f322251ce00e/versions