Confluence REST API V2: Get all labels in a space

Hey folks,

I’m building a new integration for Confluence, and a key use-case for us is being able to filter down which pages we return to a user based on the labels on the pages. In our UI, we’d like to be able to present users with a drop-down list of all of the labels available in their space, so that rather than just arbitrarily typing in labels in our filters and hoping that the spelling, etc. is the same, we’d like to present them with the actual list of labels in the space.

I can see that there was a method of doing this in just one call in API v1 on the getSpaces endpoint:

/wiki/rest/api/space/{spaceKey}/content?expand=metadata.labels

But it looks like in V2, I would need to:

  • Get the space
  • get the list of pages in the space
  • iterate through every page and collect their labels
  • deduplicate the list and present it to the users

… which is potentially an enormous amount of calls for something that used to be one.

Although in theory I could use the currently deprecated V1 spaces endpoint, given that this is a new app, I’d like to start on the right foot and use the new standard V2 API from the beginning, and not have to redo things in a few months when V1 is gone for good.

Is there really no better method of getting this label information right now than potentially something that would cost hundreds of calls?

Thanks in advance!

2 Likes

I believe this is a known outage that is in progress. No ETA that I have seen however.

https://jira.atlassian.com/browse/CONFCLOUD-76344

See also this post.

1 Like