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

0 votes


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!



Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

283 views 2 11
Read article

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