It’s actually not that bad, I probably should have learned a while ago. My use case for it is writing Confluence Macros and plugins for both Confluence and Jira. I started with the plugins, for simplicity’s sake.
My inspiration came from a post on the Atlassian Community Forums. Someone had requested a way to essentially mirror the setup of a macro. But they wanted to mirror the most recent child page, of a parent page.
Digging Into The Problem
Okay so what do we actually need the script to do? We need it to:
- Figure out the most recently updated child page of a parent page
- Fetch the macro setup of the child page
- Update the parent page accordingly
These are the three high-level functions that the macro needs to accomplish.
Figuring out the most recently updated child page wasn’t hard. You can make a call to baseURL + pageID + “/child/page?limit=1000&expand=history.lastUpdated. This returns a list