如何通过复制现有页面和使用REST API在Confluence中创建子页面

时间:2016-09-11 09:51:46

标签: confluence confluence-rest-api

我使用以下代码在现有父级下创建子页面:

curl -v -u admin:password -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"Created by API", "ancestors":[{"id":97585021}], "space":{"key":"Some_Key"},"body":{"storage":{"value":"<p>This is a test page created by API. Pls ignore</p>","representation":"storage"}}}' https://confluence.ges.symantec.com/rest/api/content/ | python -mjson.tool.

使用此功能,我成功​​地在父内容ID 97585021下创建了一个子页面。

接下来我要做的是:使用另一个充当模板的页面在父ID 97585021下创建一个页面。模板页面位于Confluence中相同的内容ID 97585021下。因此,我希望将所有页面创建为此页面的副本。

我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:2)

第一步,只需在Confluence中获取模板的页面正文内容: https://confluence.ges.symantec.com/rest/api/content/1234?expand=body.storage

参考:https://docs.atlassian.com/confluence/REST/latest/#content-getContentById

使用提取的正文内容,根据需要进行一些修改,最后通过执行完全相同的请求来创建子页面。

相关问题