how to get full content body (html) using confluence REST API ?
Asked by Sameer V:

Example API call to get content - https://\<domain\>/rest/api/content/12345

I'm not able to find out a way to get the whole content body. Although, this

```
{"webui":""...}
```

gives the URL to get the actual content on the browser, is there no way to get the actual html content in the JSON response itself?


Answers:
author: Lei Wang
body: Hi,

You could read the content of a page with the body expanded.

```
https://<domain>/rest/api/content/12345?expand=body.storage
```

Please refer to the Confluence REST API examples for more details: <https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/>

comments: author: Sameer V
body: That works. Thanks [@Lei Wang](/t5/user/viewprofilepage/user-id/1171672)!


author: Arjun s
body: That was very helpful!


author: Rigin Oommen
body: Awesome. ? this worked for me


author: Kimberly Cook
body: How can you search for the content ID?


author: Pranesha Bunsee
body: If you want the page ID, go to Tools --\> Page Information on the particular page you are interested in. You should see the page (content) ID shown in the URL when you do this.


author: Rafael Ruiz
body: I have a question: how can we push HMTL to body?


author: Mahmoud Turki
body: thank you


author: Cliff Berg
body: It no longer works. Seems like:

1. The ability to programmatically (using the Forge API) to access a prior version of a page no longer works.

2. The ability to obtain the _content_ of a prior version of a page, even by entering the URL query in a browser, no longer works.

E.g., this does not work using Forge:

const vresp = await api.asApp().requestConfluence(route\`/wiki/rest/api/content/7208974/version/20??expand=body.storage\`, {  
headers: {  
'Accept': 'application/json'  
}  
});  
...  
and neither of these work in a browser:  
Old API:  
<https://agile2academy.atlassian.net/wiki/rest/api/content/7208974/version/37/?expand=body.storage>  
(does not show the body.storage.value - i.e. the content of the page)  
...  
New API does not seem to have a way to retrieve page content for prior page versions. Docs are here:<https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-get>  
So I tried this:  
<https://agile2academy.atlassian.net/wiki/api/v2/pages/7208974/versions/37/expand=body.storage>  
(produces page not found)


author: Lei Wang
body: Hello [@Cliff Berg](/t5/user/viewprofilepage/user-id/1462184)

Thank you for the update. The API is designed for Confluence **Server and Data Center**, and not for Confluence Cloud. I have performed a quick test and can confirm that it is still functional in Confluence Server/DC 7.19 LTS.

Best,

Lei


author: Cliff Berg
body: Thanks for the reply. That clarifies things.

Does that mean that for Confluence Cloud, there is no way to obtain the actual content of an earlier version of a page?

I just tried these in a browser, and the body field that is returned is an empty string (but the actual body should not be empty):

[https://agile2academy.atlassian.net/wiki/rest/api/content/7208974/?body-format=atlas_doc_format\&version=37](https://agile2academy.atlassian.net/wiki/rest/api/content/7208974/?body-format=atlas_doc_format&version=37)

[https://agile2academy.atlassian.net/wiki/rest/api/content/7208974/?body-format=storage\&version=37](https://agile2academy.atlassian.net/wiki/rest/api/content/7208974/?body-format=storage&version=37)

I also tried this,

<https://agile2academy.atlassian.net/wiki/api/v2/pages/7208974/versions/37/>

but the response does not even have a body field.

Thanks.


author: Olexiy Kovtunenko
body: [@Cliff Berg](/t5/user/viewprofilepage/user-id/1462184) what worked for me was using this:

...../wiki/api/v2/pages/1234567?body-format=ATLAS_DOC_FORMAT


author: Priten Vora
body: Thank you, that helped a lot!


Tags: atl-dev

confluence-server

developer

rest-api