API to script changes to pages?


We would like to migrate our on-premises Confluence to Confluence Cloud however we have used a custom user NoPrint macro throughout most of our pages. Unfortunately user macros are not supported in the Cloud. We don't mind removing the macro but we have thousands of pages so manually updating the content is not a viable option.

Can I migrate the content to the Cloud and then update our pages via an API or some other kind of scripting?

Any suggestions would be greatly appreciated.



2 answers

This widget could not be displayed.


The Confluence REST api has what i think you need, I would approach it like this:

1) Use CQL to find all pages with your macro on it (See: https://developer.atlassian.com/confdev/confluence-rest-api/advanced-searching-using-cql#AdvancedSearchingusingCQL-macroMacroMacro).  I just had a thought, this may not work with a macro that is no longer installed.  If it doesn't, you can just parse all pages.

2) For each file, you can parse the structured storage format using the content api (See: https://developer.atlassian.com/confdev/confluence-rest-api/confluence-rest-api-examples)

3) The storage format is well structured XHTML so you can use jquery or some other library to parse and manipulate it.

Good luck!



This widget could not be displayed.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

471 views 6 6
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