我使用以下代码在现有父页面下创建子页面:
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。因此,我希望将所有页面创建为该页面的副本。
我怎样才能实现这个目标?
最佳答案
第一步,只需在 Confluence 中获取模板的页面正文内容: https://confluence.ges.symantec.com/rest/api/content/1234?expand=body.storage
引用号:https://docs.atlassian.com/confluence/REST/latest/#content-getContentById
使用提取的正文内容,根据需要进行一些修改,最后通过执行与您所做的完全相同的请求来创建您的子页面。
关于confluence - 如何通过复制现有页面并使用 REST API 在 Confluence 中创建子页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39434864/