Confluence REST API content pagination: totalSize and willPaginate reliability for large spaces
0 reputation · 11 Oct 2023, 16:06 UTC
I am building an export job that walks all pages in a large Confluence space using GET /rest/api/content with the start and limit parameters. The space contains tens of thousands of pages, and I need to know when I have genuinely reached the end of the dataset.
My plan is to loop, incrementing start by limit each call, and stop when the returned page is short or when start exceeds totalSize. However, I have seen indications that totalSize may be capped or inaccurate for very large result sets, and that the willPaginate flag in the response metadata may not always agree with it. I am also unsure what happens if content is created, deleted, or re-indexed while the loop is running, since the offset-based start value could shift mid-iteration.
Assume a recent Confluence Data Center version with the default confluence.query.max-results system property. I can verify behavior empirically against a test space, but I want to understand the documented contract first.
- Is
totalSizeguaranteed to reflect the full retrievable result count, or can it be truncated above a threshold? - Should termination be based on
willPaginate, a short page, orstart >= totalSize? - Is there a documented cursor or stable-ordering option that avoids skipped or duplicated items when the index changes during iteration?