It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get title and link from my public page via API?

Hello!
How can I get the title and link of my Confluence pages through the API?
I would like to get via JavaScript or PHP.

2 answers

How about using the get content by id REST API? Example frontend JS:

var pageId = '12345';
var url = AJS.contextPath() + '/rest/api/content/' + pageId;

$.get(url).done(function(response) {
var links = response._links;
var pageUrl = links.base + links.context + links.webui;
var pageTitle = response.title;

console.log(pageTitle, pageUrl);
});

Theoretically you don't even need to build the URL from the response object. You could just append the pageId to "/pages/viewpage.action?pageId=" to get the link.

Best regards,
Sven

0 votes
Neil Atlassian Team Jan 07, 2020

The Confluence Cloud API documentation has details about the GET content method, along with some code snippets for Node, Python, and PHP.. and curl. 

https://developer.atlassian.com/cloud/confluence/rest/#api-api-content-get

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in New to Confluence

Fast-track your Confluence onboarding with the Confluence product guides!

Hey there! New in town? Check out the new Confluence product guides! They are chock-full of helpful tips, tricks, and best practices to get you and your team started.  Here’s a quick overview...

731 views 3 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you