migrate html content into confluence

I am trying to migrate an old Knowledge Base into Confluence but I can only get the content as HTML files inside of an SQL dump.
Is there any way I can migrate all of the articles in the SQL dump into a Confluence space?
I have tried UWC but it does not recognize SQL DB's.

2 answers

Hi,

How I would approach this problem:

  • Will extract the HTML content from the SQL dump into files and will create the directory structure I want/need
  • Will create an empty new space in Confluence
  • Will write a simple script that will traverse the files and will use Confluence REST API to import each file as new page https://docs.atlassian.com/confluence/REST/latest/#d3e865

A little bit of work, yeah... but not that complicated wink

Thanks! I will check this out. So how will this work if I have a template in the Confluence space I want to use so all articles are organized in the same way? I know that all new articles going forward will use the template but I am not sure if an import can be told to use a template format.

So, you get your Template as HTML and merge it with the HTML from the file and use the merged result to put it inside confluence (via rest api as mentioned earlier)

How would I tackle the first bullet you listed (extract the HTML content from the SQL dump)?

It depends on how you want the HTML content retained and whether it is a one time import. There are a few choices.

  1. Create pages with the HTML content imbedded in an html macro. Either use the system supplied html macro (must be enabled) if you only have trusted users on your site or use the HTML Macro included with HTML for Confluence that can be secured with Macro Security for Confluence. You can use the Confluence SOAP or REST apis to create the page content if you have those skills or use storePage from Confluence Command Line Interface (CLI)
  2. Put the files in the file system so they can be referenced by the HTML Macro (can't use the built-in html macro) and then create your pages as in 1) except the page content would just be a single HTML Macro with no body that references the file as a parameter.
  3. Attach the files to Confluence. For instance, using addAttachment from Confluence Command Line Interface (CLI). Do the same as 2), except reference the attachment instead of the file system.
  4. If your html is really clean (well formatted) and you only need to do the import once, you might be able to import it directly into a page (without using html macro) using storePage with the noConvert option. 

 

I am glad to hear I have some options. I will look into these. Thanks!

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Thursday in Off-topic

Friday Fun: Magic Eyes

...staring into the background. Once the image pops out in 3D, you can look around the picture and enjoy. If you will see if you are a true illusion master! :) You did it? :) Wow! Awesome! As a bonus...

420 views 79 11
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you