Hi experts,
I am working on a project to migrate several thousand Notion and Basecamp pages into Confluence using the Confluence API and Python. For the most part, I have it working, pages are created automatically and the original content, attachments, and images are uploaded as well.
I can create the pages, but there are SEVERAL issues with the pages once they are created. However, my main issue is as follows:
- Pages are created, but by default they use the old editor UI. I can go in and manually update them to use the new UI, but this dramatically changes the formatting and HTML of the page once the change is completed.
- There are several other formatting issues that are fixed by switching to the new editor, but even more new problems are created.
My goal here is to understand how best to translate my content from an HTML export into a visually coherent Confluence page.
I have already tried the methods recommended by these posts. I have seen them frequently referenced when I tried to google solutions, but I have tried them and they have not worked for me.
https://community.atlassian.com/t5/Confluence-questions/Creating-space-using-REST-API-creates-it-with-quot-old-quot/qaq-p/1275954
https://jira.atlassian.com/browse/CONFCLOUD-68057
Any help or direction here would be greatly appreciated! Happy to answer any other questions or expand upon my process in the replies to this post. Thank you!
For reference, here is my POST request that I use to create pages. I'm not having any trouble actually creating the page, my auth and url arguments work just fine.
url = "https://{myorg}.atlassian.net/wiki/api/v2/pages"
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.dumps({
"spaceId": spaceId,
"status": "current",
"title": title,
"parentId": parentId,
"body":
{"storage": {"value": htmlupload, "representation": "storage"},
"metadata": {
"properties": {
"editor": {"value": "v2"},
"content_appearance_draft": {
"value": "fixed-width"
},
"content_appearance_published": {
"value": "fixed-width"
}}}}}
)
response = requests.request(
"POST",
url,
data=payload,
headers=headers,
auth=auth,
verify=False
)