Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get PAGEID and URLS for particular SPACE

Mark Jennings April 29, 2020


Is there a way in Scriptrunner in Confluence I can get the the Title, URL and PAGEID of all pages in a particular space?



1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Lee Wonnacott
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 30, 2020

Hi Mark! 

You can get these values with the following script: 

import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.setup.settings.SettingsManager

PageManager pageManager = ComponentLocator.getComponent(PageManager)
SpaceManager spaceManager = ComponentLocator.getComponent(SpaceManager)
SettingsManager settingsManager = ComponentLocator.getComponent(SettingsManager)

def space = spaceManager.getSpace("<your_space>")
def homePage = space.getHomePage()

def listOfPages = homePage.getDescendants()
String baseUrl = settingsManager.getGlobalSettings().getBaseUrl();

listOfPages.each {
log.warn "Page title: " + it.getTitle()
log.warn "Page Url: " + baseUrl + it.getUrlPath()
log.warn "PageID: " + it.getContentId()


Mark Jennings May 10, 2020

Thanks, managed to get what i needed from a SQL script and lots of Excel Manipulation

Sunny Kanade May 6, 2022

Hi Mark, Worked for me as well. It is just an improvement to use string null and empty check before using it to avoid null exceptions. 

AUG Leaders

Atlassian Community Events