The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

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

Equipe Desenvolvimento
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!
December 26, 2019

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Sven Schatter _Lively Apps_
Atlassian Partner
December 27, 2019

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 Mansilla
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 7, 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

TAGS
AUG Leaders

Atlassian Community Events