I am trying to find the Java API that will add a comment on the "Page History" Page under the comment column. So what I am doing is when something on my macro changes, I force the page update like so:
pageManager.<Page>saveNewVersion(page, page1 -> page1.setBodyContent(content));
As expected the page gets updated with a new version.
But I want to add a comment in the "Comment" column of the "Page History" page stating something like "The page version was created because the macro content was changed". Please advise if there is any Java API I can use to achieve this.
pageManager.<Page>saveNewVersion(page, page1 -> {
page1.setBodyContent(content);
page1.setVersionComment("Version created by the plugin");
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Yagnesh Bhat ,
not sure if anyone here will be able to give you an answer specifically for the Java API, so I would suggest asking your question in the Atlassian Developer community, you might have more luck here : https://community.developer.atlassian.com/c/confluence/6
As far as I know, this is possible with the regular REST API so you should be able to do it with the Java API :
PUT /wiki/rest/api/content/{content_id}
{
"id": "content_id",
"title": "Page title",
"space": {"key": "SPACEKEY"},
"type": "page",
"body": {
"storage": {
"value": "Page body",
"representation": "storage"
}
},
"version": {
"message": "version comment",
"number": 2
}
}
Let me know if this helps,
--Alexis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alexis Robert , thanks for the reply. I found the way to do it from the Java API itself:
pageManager.<Page>saveNewVersion(page, page1 -> {
page1.setBodyContent(content);
page1.setVersionComment("Version created by the plugin");
});
Converting this to answer and also updating the same answer in the question I asked in Developer community for reference.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.