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.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.