Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get label value

Sundar sarma
Contributor
February 1, 2023

Could you please suggest to us how to get the label value?

I have attached a screenshot below.

while fetching the resultset from json response to java, I am not getting the label field itself.

Trying to get this value from java methods.

 

 

label.PNG

 

2 answers

0 votes
Vamsi Kandala
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.
February 1, 2023

Hi @Sundar sarma

What is the REST API call URL that you are using?

There are separate API calls for retrieving the content of the page and retrieving the labels.

Please refer to this for more info: https://docs.atlassian.com/ConfluenceServer/rest/8.0.3/

Hope this helps.

Thanks,
Vamsi

0 votes
Andrii Maliuta
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.
February 1, 2023

Hello @Sundar sarma ,

Please give more information on what methods you use and on what data as it is not clear.

Label is attached to Page and is stored with its ID, text and other parameters. You can et label data by its ID or by getting page and then its labels and then it s data and so on...

Sundar sarma
Contributor
February 1, 2023

@Andrii Maliuta I am using getChildFromParent(parentpageid) from ConfluenceRestServiceApi. It is fetching all the childrens for the mentioned parent page id.

But I did not get any label info.

I am trying to get all labels for all childrens. How to get this

Andrii Maliuta
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.
February 2, 2023

Hello @Sundar sarma ,

Not sure abour "ConfluenceRestServiceApi" class ad this API, as I usually see other services/managers used, such as PageManager, PageService, LabelManager, LabelService, etc.

Here is an example:

PageManager pageManager = ComponentLocator.getComponent(PageManager.class);
SpaceManager spaceManager = ComponentLocator.getComponent(SpaceManager.class);
Space space = spaceManager.getSpace("SPACE_KEY");
List<Page> pages = pageManager.getPages(space, true);
pages.forEach(page -> {
page.getLabels().forEach(label -> {
...
});
});

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events