Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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 Leaders.
Sep 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

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)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events