1

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

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。所以我希望所有页面都创建为该页面的副本。

我怎样才能做到这一点?

4

1 回答 1

2

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

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

使用提取的正文内容,如有必要进行一些修改,最后通过执行与您所做的完全相同的请求来创建您的子页面。

于 2016-09-11T11:51:51.753 回答