Q. Confluence Server / Data Center を利用しています。REST API経由で子ページの情報を取得する場合、どのような形でリクエストすれば良いでしょうか。
関連記事: [FAQ] REST API経由で Confluence Server / Data Center のページのコンテンツ内容を取得したい
A. REST API のエンドポイント “Children” GET /api/content/{id}/child
に対して、パラメータ "expand=page" を付与してリクエストすると、ページのコンテンツ内容を含めて取得することが可能です。
Confluence 7.19.16の場合: https://docs.atlassian.com/ConfluenceServer/rest/7.19.16/#api/content/{id}/child-children
サンプルリクエストとサンプルレスポンスは下記になります。
・サンプルリクエストURL: (基本URL)/rest/api/content/98344/child?expand=page ※pageid=98344の子ページを取得
・サンプルレスポンス:
{"page":{"results":[{"id":"1605633","type":"page","status":"current","title":"This is child page これは子ページです","extensions":{"position":"none"},"_links":{"webui":"/pages/viewpage.action?pageId=1605633","edit":"/pages/resumedraft.action?draftId=1605633&draftShareId=b55b79b2-e7da-42d1-8587-d58baae64aba","tinyui":"/x/AYAY","self":"(基本URL)/rest/api/content/1605633"},"_expandable":{"container":"/rest/api/space/TEST","metadata":"","operations":"","children":"/rest/api/content/1605633/child","restrictions":"/rest/api/content/1605633/restriction/byOperation","history":"/rest/api/content/1605633/history","ancestors":"","body":"","version":"","descendants":"/rest/api/content/1605633/descendant","space":"/rest/api/space/TEST"}}],"start":0,"limit":25,"size":1,"_links":{"self":"(基本URL)/rest/api/content/98344/child/page"}},"_links":{"base":"(基本URL)","context":"","self":"(基本URL)/rest/api/content/98344/child"},"_expandable":{"attachment":"/rest/api/content/98344/child/attachment","comment":"/rest/api/content/98344/child/comment"}}
※本記事は Confluence Data Center v 7.19.16 にて検証を行っています。
Ryoji Takata
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
0 comments