How can I get actual content of Page, Blogpost and Comments using Confluence Cloud REST API?

Yash Chaudhari August 14, 2018

To get the actual content I tried using Get Content by Id API : https://{{host}}/wiki/rest/api/content/:id?expand with providing value for expand parameter as body.view, body.storage, body.styled_view, in response it give data as value to body key however it returns data as html form

For attachment using Get Attachments API : https://{{host}}/wiki/rest/api/content/:id/child/attachment? it returns,  _links  object with webui, download key value in response, using which we can get actual content for attachment.

Please help to get actual content of Page, Blogpost and Comments using Confluence Cloud REST API.

Thank you.

1 answer

0 votes
huy
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 19, 2018

Are you looking for a plain text representation of the body content?

Yash Chaudhari October 4, 2018

Yes, I am looking for plain text representation.

huy
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 5, 2018

Sorry, but this doesn't exist as content entered into confluence is rich and saved as such. To convert downward would be a loss of information and we'd have to make make opinionated choices as to how elements would be converted. For example maybe we could convert to markdown, but what if there is a table? Markdown doesn't natively support tables and as such we'd have to use an esoteric variant. Probably not what you wanted to hear, but I hope this gives you some insight into why we wouldn't want to support this.

Paul Frischknecht December 4, 2021

Save the output of body.view to an output.html file, then use w3m -dump output.html to get a plaintext representation

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events