I am using python to format data point into a Confluence storage format and update the page through REST API. The request did go through and it updated the table content but the chart is not displaying.
I am getting this message from the update confluence page:
No data to display
We can’t find this chart’s source table on the page.
When I go to editing mode, the chart display correctly, and the Update button show up even though I did not make any editing after sending the update request. I update the page and now the page is update. What is causing this issue? and how can I fix this?
Please help
Thanks,
Hi @Thanh Lam - In some cases specific content or properties may handled differently by system, so i recommend logging a support ticket with Atlassian to get their opinion.
Best Regards
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Thanh Lam - Thanks for confirming, hopefully you can also ensure all the tags closed correctly with the required parameters. Atlassian Document Format
The incomplete structure may be contributing to the issues with chart rendering after API updates.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Thanh Lam for confirming.
Let me take some time to analyze what other options would have causing the issue. Will keep you posted.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thanh Lam
Looks like it is due to how the macro processes its source table.
It may due to its dynamic binding to a data source, such as a table, in the Confluence storage format. When updating the page content via the REST API, the macro may not properly reprocess the data source until a manual update is triggered in the editor.
You can give a try by programmatically trigger a page re-render after updating the page through the REST API. This can be achieved by using one of two approaches: updating the page twice with minor modifications to trigger a re-render, or simulating the behavior of editing and saving the page using the Confluence API, which involves retrieving the page content, updating it as needed, and updating the page properties to trigger a full re-render.
Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi VJ,
I did try the method of getting back the body storage of the updated page, append new content under the old content and update it again. The new content did show up but the chart still not render. Not sure what I am missing in the html content.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thanh Lam
First, ensure that the HTML structure of your table is correct and sticks to Confluence's storage format requirements.
Also, verify that the chart macro is configured correctly and is pointing to the right data source.
Besides, confirm that you are incrementing the version number in your API request, as this is crucial for Confluence to recognize your update as a new version. If possible, consider moving your data table to a separate page and using the Page Include macro to reference it in your chart page.
You can also try using a simplified version of your table with static data to see if it renders correctly.
Best Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Humashankar VJ ,
I created the table and chart manually on a separated page and get the body storage of that page to compare with the HTML structure that I generated from my script. The output look identical and the weird thing is that I even try to use to html that I got from the manual to update on a new page, it still not render. I am trying to use the chart plotting by confluence instead of chart macro (the look is better). As for the version number, I do update it every time i update the page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thanh Lam
Your approach to troubleshooting the issue by comparing manually created content with script-generated HTML is a good starting point.
But, the fact that even manually created HTML doesn't render the chart when updated via the API suggests that the issue goes beyond content structure.
To further investigate, consider examining the API request structure to ensure it includes all necessary fields, particularly the representation parameter. Additionally, try the double update method by updating the page twice in quick succession, first with the chart content and then with a minor change.
Best Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Humashankar VJ ,
Here is my API request structure,
def update_conf_page_content(self, page_id: str, page_title: str, page_content: str) -> None:
"""
Function to update confluence page content by page ID
"""
url = f'{self.conf_base_url}/pages/{page_id}'
version = self.get_conf_page_version(page_id)
updated_version = version + 1
data = json.dumps({
'id': page_id,
"status": "current",
'title': page_title,
'body': {
'representation':'storage',
'value': page_content
},
'version': {
'number': updated_version
}
})
I has been trying to update it twice to thrice as you suggested but no luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the update, let me research some from my end on this and will get back to you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thanh Lam
Looks your API Structure is all good.
I recommend checking the page_content includes both the table and the chart macro, and that the macro references the correct table, also that the ac:structured-macro block is defined correctly it may also give some issues.
Best Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Humashankar VJ ,
My scripted html structure does not have ac:structured-macro tag because I am trying to implement to default chart of confluence rather than using it macro. Here is the short capture from my scripted html that I try to update to confluence page.
<ac:adf-extension>
<ac:adf-node type="extension">
<ac:adf-attribute key="extension-key">
chart:default
</ac:adf-attribute>
<ac:adf-attribute key="extension-type">
com.atlassian.chart
</ac:adf-attribute>
<ac:adf-attribute key="parameters">
<ac:adf-parameter key="chart-type">
LINE
You can get something similar if you chart your data from the option that appear on the table that you created on confluence page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the insight, let me deep dive on this and will get back to you.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thanh Lam
Can you confirm your ADF extension status? This will help out to get problem statement moving.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Thanh Lam
To determine the format of a page, send a GET request to the Confluence REST API. The response will indicate whether the page is stored in the Atlas Document Format (ADF) or the legacy storage format.
GET https://your-instance.atlassian.net/wiki/rest/api/content/{contentId}?expand=body.atlas_doc_format
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.