Apache Sling:通过REST API访问版本



我正在尝试检索吊索中可版本节点的版本历史。

我创建了一个可版本的节点,已签出,上传了一个新版本并将其检查为

curl -u admin:admin -T test.txt http://localhost:8080/apps/versions2
curl -u admin:admin http://localhost:8080/apps/versions2/test.txt -X POST -F"jcr:mixinTypes=mix:versionable"
curl -u admin:admin http://localhost:8080/apps/versions2/test.txt -X POST -F":operation=checkout"
curl -u admin:admin -T test.txt http://localhost:8080/apps/versions2/test.txt
curl -u admin:admin http://localhost:8080/apps/versions2/test.txt -X POST -F":operation=checkin"

但是,当我尝试按照此增强请求所建议的那样拉动版本历史记录时,它不起作用。

curl -u admin:admin http://localhost:8080/apps/versions2/test.txt.V.tidy.json
{
"jcr:primaryType": "nt:file",
"jcr:mixinTypes": ["mix:versionable"],
"jcr:createdBy": "admin",
"jcr:versionHistory": "31d1e0e8-22b0-476d-b591-b7441073f0fc",
"jcr:predecessors": [],
"jcr:created": "Mon Nov 20 2017 13:31:47 GMT+0100",
"jcr:baseVersion": "00b9682c-9402-4c5f-a759-8f1837e55e35",
"jcr:isCheckedOut": "false",
"jcr:uuid": "0e1784aa-51c2-4901-b56d-89f8dcea9744"
}

我的计划B是读取/jcr:system/jcr:versionStorage的节点,但我不知道如何通过WebDav API访问它。

版本Info Servlet的配置策略设置为 require ,这意味着直到明确设置配置时,此servlet才会处于活动状态。

因此,您可以转到System Config(http://localhost:8080/system/console/configmgr),搜索 apache sling sling版本信息servlet ,单击并保存默认配置,而不是您将可以按预期获得该节点的版本。

最新更新