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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,422
Community Members
 
Community Events
184
Community Groups

Confluence Server DB - Looking for Space Category

Where can I find the Space Category in the database?

1 answer

1 accepted

1 vote
Answer accepted
Matt
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.
May 17, 2023

Does it have to be DB? The schema doc doesn't clearly show the relation between the 'label' table and the 'space' table.

https://confluence.atlassian.com/doc/confluence-data-model-127369837.html

You can execute this as a starting point:


select * from label where NAMESPACE = "team"

However, I'm not 100% sure that labels in the 'global' namespace cannot also be used on spaces. So, I don't know if the above query returns a complete dataset. This query gets both global and space labels but not page-specific ones.

select * from label where NAMESPACE = "team" or NAMESPACE = "global"

Either way, those queries only give you what labels have been added and does not show any relation to what they were added to, which may be what you're actually looking for.

It's fairly trivial to get that data from the REST API and then parse it as needed:

  1. Get a list of all of the space keys either from the DB or from the API:
    # DB
    select spacekey from spaces
    # API - you'll have to paginate through the
    https://<confluence-url>/rest/api/space?limit=500
  2. Take the list of space keys returned and for each one send a request to this endpoint:
    https://<confluence-url>/rest/api/space?spaceKey=<SPACEKEY>&expand=metadata.labels

Your output will look something like this for each request:

{
"results": [
{
"id": "<SPACE-ID>",
"key": "<SPACE-KEY>",
"name": "<SPACE-TITLE>",
"type": "global",
"metadata": {
"labels": {
"results": [
{
"prefix": "team",
"name": "<LABEL-NAME>",
"id": "<LABEL-ID>"
},
{
"prefix": "team",
"name": "<LABEL-NAME>",
"id": "<LABEL-ID>"
},
{
"prefix": "team",
"name": "<LABEL-NAME>",
"id": "<LABEL-ID>"
}
],
"start": 0,
"limit": 200,
"size": 3
}
},
"_links": {
"webui": "/display/<SPACE-KEY>",
"self": "https://<confluence-url>/rest/api/space/<SPACE-KEY>"
},
"_expandable": {
"icon": "",
"description": "",
"homepage": "/rest/api/content/<SPACE-HOME-ID>"
}
}
],
"start": 0,
"limit": 25,
"size": 1,
"_links": {
"self": "https://<confluence-url>/rest/api/space?spaceKey=<SPACE-KEY>&expand=metadata.labels",
"base": "https://<confluence-url>",
"context": ""
}
}

 

Hopefully that's a starting point for you. Good luck!

Thanks for the detailed response.

 

This at least gives me one avenue to get what I need.

Like Matt likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.13.14
TAGS
AUG Leaders

Atlassian Community Events