How to Fetch Page Information Containing Pagename, Url, Creator, Lastmodifiedby From the Confluence Database
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article will help you to retrieve detailed Page information from your Confluence database.
Solution
The below SQL queries will fetch the following Page information data:
- PageName
- Creator
- CreationDate
- LastModified Date
- SpaceName
- LastModifier Username
- PageURL
Note: Please replace the http:localhost:6720/c6720 value with your own base url value.
SELECT c.title as PageName,
u.username AS Creator,
c.creationdate,
c.lastmoddate,
s.Spacename,
um.username AS LastModifier,
CONCAT(CONCAT ('http:localhost:6720/c6720','/pages/viewpage.action?pageId='), c.contentid) AS "Page URL"
FROM content c
JOIN user_mapping u
ON c.creator = u.user_key
JOIN user_mapping um
ON c.lastmodifier = um.user_key
Join Spaces s
on c.SpaceID= s.SpaceID
WHERE c.prevver IS NULL
AND c.contenttype = 'PAGE'
AND c.content_status = 'current'
Order by s.spacename
;
SELECT c.title as PageName,
u.username AS Creator,
c.creationdate,
c.lastmoddate,
s.Spacename,
um.username AS LastModifier,
CONCAT ('http:localhost:6720/c6720','/pages/viewpage.action?pageId=', c.contentid) AS "Page URL"
FROM content c
JOIN user_mapping u
ON c.creator = u.user_key
JOIN user_mapping um
ON c.lastmodifier = um.user_key
Join Spaces s
on c.SpaceID= s.SpaceID
WHERE c.prevver IS NULL
AND c.contenttype = 'PAGE'
AND c.content_status = 'current'
Order by s.spacename;