Get all content metadata in json for space

Hello Everyone,

                       I am newbie to confluence rest api and I am trying to pull all content in my space. Below is link I am using:


I believe this will pull all content metadata as json for space1, alongwith version.

This is not giving me everything in json. They is lot of missing metadata for space1, not appearing in json file.

Increasing limit is not making any difference in json content I am getting back.

Could you please help here, if I am doing something wrong?

Thanks in advance.

1 answer


You need to ask Confluence to expand the response further. The Confluence API uses expandable elements - in your example, you've only expanded version. You can see which elements are expandable by looking at the _expandable element in the response when you do a GET.

It will look something like this:

"_expandable": {
        "container": "/rest/api/space/TEST",
        "metadata": "",
        "operations": "",
        "children": "/rest/api/content/1234/child",
        "history": "/rest/api/content/1234/history",
        "ancestors": "",
        "body": "",
        "version": "",
        "descendants": "/rest/api/content/1234/descendant",
        "space": "/rest/api/space/TEST"

Each of these elements can be expanded further in the payload with the expand parameter on the request. If you're trying to get all content, try starting by expanding ",version".

From there, if there is still other meta info that you want, examine the result for more expandable markers and add them accordingly until you have all the data you need

Hope this helps!

Thanks Aaron for your response. This absolutely helped me to get more details for any specific title related information.
My issue is related to pages I am getting in result json .

I find out the limit restriction on my confluence. Even I mentioned limit as 2000, it is giving me only 200 back.

How I can increase system limit to a higher value?


I apologize for misunderstanding your question; I thought what you meant by "missing metadata" was that information about the page was missing, i.e, the content.

Your use of the limit parameter is correct, but it seems to me that the limit parameter has a ceiling of 200. If you look at the last part of the response:

"start": 0,
  "limit": 200,
  "size": 169,
  "_links": {
    "self": "https://localhost/confluence/rest/api/content?spaceKey=TEST&expand=version",
	"next": "/rest/api/content?spaceKey=TEST&expand=version&limit=5&start=5",
    "base": "https://localhost/confluence",
    "context": "/confluence"

It'll note what the limit is on returned content. It seems that any value >= 200 is capped at 200; anything lower than that will match what you specify. I am not sure if it is possible to increase this maximum limit.

However, what you can do, is write your Java code for parsing in a while loop, that will keep calling the URL designated as next and aggregating the results.

You can do something like the following:

1) Parse the JSON, store results as you deem fit

2) Look for the _links block in the trailer

3) If next is not null, do a GET on the provided URL

4) Repeat until next is null

That way you'll aggregate the results and get everything. It is more service calls but will get you your data.

Hope this helps you!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Dec 18, 2018 in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

458 views 3 18
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you