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

This widget could not be displayed.

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)?

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

151 views 16 7
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