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 properly work with the Java API?

Hauke Bruno Wollentin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
September 21, 2023

Hi there,

I don't get how to work properly with the Java API of Confluence Data Center.

There are Manager interfaces like in Jira, for instance the PageManager. But all of the getPage() methods has been deprecated with a reference to the PageManagerInternal interface which do not provide simple getPage() methods, for example for just throwing in a known page ID.

So my question is: How to work with the Confluence Java API directly? We use ScriptRunner and do not (nor want to) write dedicated/custom plugins.

Best regards,
Hauke

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Marcus Hansson
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!
October 5, 2023

I am not very familiar with ScriptRunner. For my custom plugin I use:

com.atlassian.confluence.api.service.content.ContentService;
com.atlassian.confluence.api.service.content.SpaceService;
com.atlassian.confluence.api.service.people.GroupService;
com.atlassian.confluence.api.service.people.PersonService;

For ScriptRunner it should work using:
@PluginModule
ContentService contentService

Reference: https://community.developer.atlassian.com/t/how-to-use-expansions-on-contentpropertyservice/46866/4

They work similar to the REST API, here's an example using ContentService (page) and expanding the space.

ContentService.SingleContentFetcher contentFinder = contentService
.find(new Expansion(Content.Expansions.SPACE))
.withType(ContentType.PAGE)
.withId(ContentId.of(pageId));


Similar approaches is for the other services. If you need more specific example, let me know.

More about the ContentService can be found in ContentService (Atlassian Confluence 8.5.0 API)

TAGS
AUG Leaders

Atlassian Community Events