1

鉴于此网址

http://localhost:8080/alfresco/service/api/sites/test-3

我回来了:

{
   "url": "\/alfresco\/service\/api\/sites\/test-3",
   "sitePreset": "site-dashboard",
   "shortName": "test-3",
   "title": "Test 3",
   "description": "",
   "node": "\/alfresco\/service\/api\/node\/workspace\/SpacesStore\/0352afea-797f-4b9e-be27-3bf37e54a2f1",
   "tagScope": "\/alfresco\/service\/api\/tagscopes\/workspace\/SpacesStore\/0352afea-797f-4b9e-be27-3bf37e54a2f1",
   "siteManagers":
   [
         "admin"
   ],
   "isPublic": true,
   "visibility": "PUBLIC"
}

如何使用该信息来获取站点中的文件夹列表?

4

4 回答 4

2

您需要使用不同的 API。看看这个 shell 会话:

$ curl -u admin:admin -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d "{'shortName':{'values':['test'], 'match':'foo'}}" http://localhost:8080/alfresco/service/api/sites/query

{
    "url" : "\/alfresco\/service\/api\/sites\/test",
    "sitePreset" : "wcmqs-site-dashboard",
    "shortName" : "test",
    "title" : "test",
    "description" : "",
        "node" : "\/alfresco\/service\/api\/node\/workspace\/SpacesStore\/e597e4c2-d307-46e3-ba4d-b911262e7261",
        "tagScope" : "\/alfresco\/service\/api\/tagscopes\/workspace\/SpacesStore\/e597e4c2-d307-46e3-ba4d-b911262e7261",
    "isPublic" : false,
    "visibility" : "PRIVATE",
    "siteManagers" : 
    [           
         "admin"  

   ]
}

// see the 'node' property up there
$ curl -u admin:admin http://p01:8080/alfresco/service/api/node/workspace/SpacesStore/e597e4c2-d307-46e3-ba4d-b911262e7261/children
[..cmis response here..]
于 2012-04-18T07:16:56.463 回答
1

一种选择是使用 CMIS。不过,根据您的具体需求,您也可以使用一些内置的 webscripts 来做列表

在站点的根目录中,您有容器,例如 documentLibrary 和 wiki。您可以从container.get webscript 获取站点的容器列表。查看 org/alfresco/slingshot/documentlibrary/container.get.desc.xml 了解详细信息。如该文件所示,它的 URL 模式是/slingshot/doclib/containers/{site}

curl -u admin:admin http://localhost:8080/alfresco/service/slingshot/doclib/containers/test
{
   "containers":
   [
      {
         "name": "documentLibrary",
         "description": "Document Library",
         "nodeRef": "workspace://SpacesStore/973338a0-db39-458e-a10d-396f00cb16a3",
         "type": "cm:folder"
      }
   ]
}

接下来,当您知道要使用容器中的哪个容器或文件夹时,treenode.get webscript 可以让您列出它,例如

 curl -u admin:admin http://localhost:8080/alfresco/service/slingshot/doclib/treenode/site/test/documentLibary
 {
    "totalResults": 0,
    "resultsTrimmed": false,
    "parent":
    {
       "nodeRef": "workspace://SpacesStore/92e4f8de-b919-4540-a27a-16c4e53a57bc",
       "userAccess":
       {
          "create": true,
          "edit": true,
          "delete": true
       }
    },
    "items":
    [
    ]
 }

我还可以建议您使用http://localhost:8080/alfresco/service/index来查看系统中存在哪些 webscripts,并获取有关它们的信息,这对此类情况有很大帮助

于 2012-04-18T10:22:41.953 回答
0

使用此 url 获取文件夹列表。

http://localhost:8080/alfresco/service/api/node/workspace:SpacesStore/store_id/b0697dd1-ae94-4bf6-81c8-5e2fa098ddfa/children
于 2014-06-23T04:44:33.123 回答
0

加载站点:http://localhost:8080/alfresco/service/api/sites/test-3

{
    "url": "\/alfresco\/service\/api\/sites\/test-3",
    "sitePreset": "site-dashboard",
    "shortName": "test-3",
    "title": "test 3",
    "description": "",
    "node": "\/alfresco\/service\/api\/node\/workspace\/SpacesStore\/0352afea-797f-4b9e-be27-3bf37e54a2f1",
    "tagScope": "\/alfresco\/service\/api\/tagscopes\/workspace\/SpacesStore\/0352afea-797f-4b9e-be27-3bf37e54a2f1",
    "siteManagers":
    [
            "admin"
    ],
    "isPublic": true,
    "visibility": "PUBLIC"
}

使用从节点属性中提取的 ID 获取站点内容:http://localhost:8080/alfresco/service/api/node/workspace/SpacesStore/0352afea-797f-4b9e-be27-3bf37e54a2f1/children

里面是一个标题为“documentLibrary”的节点。使用它的 ID GUID,您可以获取更多的孩子

http://localhost:8080/alfresco/service/cmis/s/workspace:SpacesStore/i/b68db1eb-547d-4b2c-b5eb-ba207a275789/children

如果您有自定义属性,它们将出现在使用此 API 调用的子项上。

使用子项的 ID,您可以获取其内容。

http://localhost:8080/alfresco/service/cmis/s/workspace:SpacesStore/i/2d53f464-bea0-46f3-aa0c-10b3302e661c/content

于 2012-04-18T21:53:18.790 回答