Confluence page modification

AKASH BHARDWAJ August 3, 2014

Hi All,

I have recently migrated contents from Trac wiki to Confluence, We have nearly 1400 pages under this space.

I wanted to automate the Pages by adding TOC macro on top of each page, seach for code section within page and insert Code block macro and inside it the code should be pasted.

Can anyone please hep me how can i move ahead with this.. I am looking for some kind of python script to start but wondering the point to get kick start.

Thank You,

Akash

1 answer

1 vote
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2014

I have a couple suggestions. One would be the Confluence Command Line Interafce. There are some handy methods in it such as find and replace that you could automate across you instance. It uses Atlassian's API to do the changes, so you know it should be a safe operations.

Another possibility would be to use the WebDAV plugin(installed by default in Confluence). You can map Confluence to a drive letter(at least you can on Windows) and then work with it as if it were just a file system. Each page has a directory with the same name as the page and inside the directory is a .txt file with the mask {page name}.txt. The .txt files have the actual page content, so it you are into scripting it you could do it that way.

AKASH BHARDWAJ August 4, 2014

Hi Davin,

Thanks, i am working on your suggestions. Hope it does a trick for me.

AKASH BHARDWAJ August 10, 2014

Hi Davin,

I have tried using CLI but there issues in communicating with Confluence instance, I even wonder even if it works for me to making bulk modification on every page as each page need to be traced and look for Heading levels based on heading level an TOC macro should be inserted, trace whole page and look for code block and insert that code into Code block macr.

Can you please let me know if there could be any other option like writing script to do these modifications, such as XML RPC, I ahve gone with these and found few method likes storePage, updatePage, but none matching my requirements.

Thank You,

Akash

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 11, 2014

I also mentioned the WebDAV plugin. You could for instance map Confluence to a drive letter and then just use you native filesystem APIs in python to edit the pages.

There is also the SOAP API and the RSET API that you might check into. If it is a one time thing though I would just get the WebDAV stuff setup. You could have it mapped to a drive in under five minutes. Then just script against it as if it were files and folders.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events