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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

REST API: Get all labels within a space

I'm trying to return all the labels within a space. Is there a way to do this?

 

Thank you,

Blake

1 answer

1 vote
Zak Laughton Atlassian Team Aug 01, 2018

Hi Blake,

There's not a way to directly search for all labels within a space using the REST API, but as an alternative you can return all pages with their labels.

You can use this URL to return all pages with their labels (replacing with your site and spacekey):

https://<sitename>.atlassian.net/wiki/rest/api/content?spacekey=<spacekey>&expand=metadata.labels

Then, you can use a script to parse through the results to find the unique labels in the metadata.labels object for each page.

-Zak

@Zak Laughton 
Hello Zak,

We are using the URL you have posted to load and search labels through a drop-down field but I think there is a small problem.

On a big scale with hundreds of pages and labels, the page takes too long to load
all the labels and it's a bit annoying.

Is there any alternative way to do this?
Like when we adding labels in a page and there are some suggestions like the photo.

Thank you,
Mixalis

image (2).png

Like Alois Igelspacher likes this

Would be indeed very nice to have an endpoint, that returns all labels used in a specific space.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,690 views 7 31
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you