Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

API to script changes to pages?

Patrick Nolan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 25, 2016

Hi,

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
Bob Swift
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.
April 26, 2016
0 votes
m@
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 25, 2016

Patrick,

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!

Cheers

Matt

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events