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

How to get space with category using Confluence REST API?

Zubaidullou November 24, 2014

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Stephen Deutsch
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.
November 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.

Zubaidullou November 25, 2014

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 February 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

TAGS
AUG Leaders

Atlassian Community Events