Hi,
I’m new to confluence, node, atlassian connect and so on.
So my problem is:
I already created two addons for our cloud, which show the page-id and page-title. Now i want to create a third addon that displays the creation date of the page. I know it is stored somewhere, because you can see it in the page info tab.
This is how I accessed the title of the page:
It would be nice to create the new app with a similar approach. Altough if this is not possible, can I add a database to the app where I store the creation dates? If so, how can I add and access a database?
You can access the metadata of a page, including creation date, via the Confluence Content REST API. In your iframe you can use AP.request to make a request to the REST API like this:
AP.navigator.getLocation(function(location) {
var contentId = location.context.contentId;
var url = '/rest/api/content/' + contentId;
AP.request(url).then(function(response) {
var createdDate = JSON.parse(response.body).history.createdDate;
console.log(createdDate);
});
});
Just make sure your app has the READ scope in its connector as described here.