Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Body Content Including Embedded Images

david kreuter
Contributor
November 7, 2018

My goal is to retrieve HTML rendered Confluence pages via the REST API in order to display pages outside from Confluence. 

To achieve this the content is retrieved in storage format:

https://confluence/rest/api/content/62030518?expand=body.storage 

The storage format looks like:

<ac:image ac:height=\"250\"><ri:attachment ri:filename=\"hqdefault.jpg\" /></ac:image>

Then the field "body.storage.value" is taken as input for the content body convert resource:

https://confluence/rest/api/contentbody/convert/styled_view

Excepted the embedded images, the pages are rendered correctly, including oder macros like JIRA issue macros. However, for images the HTML looks like

<img src=\"/plugins/servlet/confluence/placeholder/error?i18nKey=editor.placeholder.broken.image&locale=en_GB&version=2\" title=\"\" class=\"transform-error\" data-encoded-xml=\"%3Cac%3Aimage+ac%3Aheight%3D%22250%22%3E%3Cri%3Aattachment+ri%3Afilename%3D%22hqdefault.jpg%22+%2F%3E%3C%2Fac%3Aimage%3E\" />

According the HTML image tag there was an transformation error. Does it mean that images could not be rendered at all? 

Is there a solution, e.g. fetching images first and then somehow correct broken links?

 

 

 

 

1 answer

1 vote
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 14, 2018

Hello David,

Glad to see you are getting some great use out of the Confluence REST API. We did see a similar issue reported as a bug (CRA-603) which has been resolve in Confluence 5.8.

With this said, which version of Confluence are your presently running?

Are the errors you are seeing from images not attached to the page you are calling?

We want to attempt to re-create your error to see if it might possibly be a bug.

Regards,
Stephen Sifers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events