Searching for content with the REST API and CQL always limits results to 50

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Searching for content using the REST API and Confluence Query Language (CQL) always returns a maximum of 50 results, despite increasing the limit parameter. For example:

BASEURL/rest/api/content/search?expand=space,body.view,history.lastUpdated&cql=type=page+AND+space.type=global+AND+lastmodified>2020-09-27&start=0&limit=50&status=current


Cause

When using the rest/api/content/search endpoint with CQL, there are limits hardcoded in the backend that govern how many results will be returned based on expansions that are requested. When the "body" expansion is specified, the limit is set to 50. If no expansions are specified, results are limited to 1000. And if other expansions besides "body" are specified, the limit is set to 200. 

Solution

Do not specify "body" expansion when using the endpoint. Using the example above, the request would look like this:

BASEURL/rest/api/content/search?expand=space,history.lastUpdated&cql=type=page+AND+space.type=global+AND+lastmodified>2020-09-27&start=0&limit=50&status=current

That will return a maximum of 200 results. 

Last modified on Nov 25, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.