How to get page content or child list via REST API

Still need help?

The Atlassian Community is here for you.

Ask the community

robotsnoindex

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Although the REST API for Confluence DC/Server is provided, sometimes it is not easy for new users to identify which one should use and how to use. The users may wonder which end points and parameters are appropriate?

The examples of below two usages are provided here for the users who have similar needs.

  • Retrieving page content for a page

  • Fetching child list for a page

Environment

Confluence DC/Server

Solution

Retrieving Page Content

If requesting the REST API endpoint of “Get Content by id” (GET /rest/api/content/{id}) with the parameter “expand=body.storage”, the page content with some meta information can be retrieved.

Here is a sample request and sample response.

Sample Request URL

(Base URL)/rest/api/content/1769476?expand=body.storage

*The target page ID is 1769476

Sample Response

{"id":"1769476","type":"page","status":"current","title":"this is title","body":{"storage":{"value":"<p>this is page content</p>","representation":"storage","_expandable":{"content":"/rest/api/content/1769476"}},"_expandable":{"editor":"","view":"","export_view":"","styled_view":"","anonymous_export_view":""}},"extensions":{"position":"none"},"_links":{"webui":"/pages/viewpage.action?pageId=1769476","edit":"/pages/resumedraft.action?draftId=1769476&draftShareId=279eb6e9-7bcb-4ef7-9517-455f0cae80a5","tinyui":"/x/BAAb","collection":"/rest/api/content","base":"https://instenv-202992-g1kk.instenv.internal.atlassian.com","context":"","self":"(Base URL)/rest/api/content/1769476"},"_expandable":{"container":"/rest/api/space/AAA","metadata":"","operations":"","children":"/rest/api/content/1769476/child","restrictions":"/rest/api/content/1769476/restriction/byOperation","history":"/rest/api/content/1769476/history","ancestors":"","version":"","descendants":"/rest/api/content/1769476/descendant","space":"/rest/api/space/AAA"}}


Fetching Child Page List

By requesting the REST API endpoint “Children” (GET /api/content/{id}/child) with the parameter “expand=page”, it is possible to retrieve the child list for a page with some meta information.

Here is a sample request and sample response.

Sample Request URL

(Base URL)/rest/api/content/98344/child?expand=page

* Fetch child page information for the parent page of 98344

Sample Response

{"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":"(Base 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":"(Base URL)/rest/api/content/98344/child/page"}},"_links":{"base":"(Base URL)","context":"","self":"( Base URL)/rest/api/content/98344/child"},"_expandable":{"attachment":"/rest/api/content/98344/child/attachment","comment":"/rest/api/content/98344/child/comment"}}


This article was verified using Confluence Data Center v 7.19.16. Please note the request and response for other versions may vary.


Last modified on Mar 7, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.