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

How to get space with category using Confluence REST API?

Hi,

I'm using REST API of confluence and successfully got page content, body etc.

  • Problem is, I can't get Space category. I could get (key, name, type, desc. etc) but no information about in which category it is.

 

2 answers

1 accepted

1 vote
Answer accepted
Stephen Deutsch Nov 25, 2014

Hi Zubaidullo,

The only one I could see that returned the space labels is the spacedirectory/1/search method (which is private, but still accessible, although I'm not sure if it's accessible from Connect).  The only problem is that there is no built-in way to filter by space key, so as long as you don't have too many spaces I would just get them all and loop through them to get the one you need (there is a query parameter, but it searches name and description, not key).

https://<your Confluence>/rest/spacedirectory/1/search?type=global

should do the trick.  You should install the REST API Browser; that would make finding API calls much easier.

Thank you, Stephen. It was useful information and I got what I needed. )) There is something about category and it's enough.

0 votes
Francis Woon Feb 27, 2017

To add on, for those of you who are having problems getting > 50 spaces, try this:

https://developer.atlassian.com/docs/developer-tools/using-the-rest-api-browser#UsingtheRESTAPIBrowser-UsingtheRESTAPIBrowserlocally

Then search for spacedirectory/1/search

The parameter starts from 0....it will return you a maximum result of 50 ( 0 ~ 49)

Thus to get 51 or index 50 onwards simply:

/rest/spacedirectory/1/search?startIndex=0&type=global

/rest/spacedirectory/1/search?startIndex=50&type=global

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

Disney Live Action Reboots: Are you for or against?

Happy Friday Everyone! Today marks the international release of Disney's live action version of the animated classic Aladdin. I know that this movie was met with some controversy of over cast...

137 views 19 8
Join discussion

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