Problem Statement:
We are attempting to use the Confluence Cloud API to fetch data from a specific space, created by a particular user within the last 7 days, and containing a specific GitLab URL. While this search works correctly in the Confluence UI, the API endpoint is not returning any results.
Steps to Reproduce
- Construct a CQL query with the following parameters:
- Space: XYZ
- Text search: URL of a GitLab merge request
- Content type: Page
- Contributor: user-x
- Last modified: Within the last 7 days
- Send a GET request to the Confluence Cloud API search endpoint (/wiki/rest/api/search) with the constructed CQL query.
- Observe that the API returns no results.
- Perform the same search using the Confluence UI search functionality.
- Observe that the UI search returns the expected results.
Expected Behavior
The API search should return the same results as the UI search when using equivalent search criteria.
Actual Behavior
The API search returns no results, while the UI search successfully finds the expected pages.
https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-search/#api-wiki-rest-api-search-get
Below is the CQL query used.
```
cql = ('space = XYZ AND ' 'text ~ "https://gitlab.company.internal/company/group/repo-old/-/merge_requests/123" AND ' 'type = page AND ' 'contributor in (user-x) AND ' 'lastModified >= now("-7d")')
```
Equivalent UI Search Works fine
https://company.url/wiki/search?text=space%3D%22QDN%22%20AND%20type%3D%22page%22%20AND%20text%20~%20%22takamol%20group%20repo-old%22%20AND%20contributor%3D%22user-x2%22%20AND%20lastmodified%20%3E%3D%20past30Days&spaces=XYZ&lastModified=past7Days&type=page
Needs Investigation ?
- Are there any differences in how the API and UI interpret CQL queries?
- Could there be permission issues that affect API searches differently from UI searches?
- Are there any known limitations or bugs with the API search functionality?
- How can we debug the API request to understand why it's not returning results?
Impact
Unable to programmatically search and retrieve Confluence content that is known to exist and is accessible through the UI. This impacts our ability to automate certain processes and integrate Confluence data with other systems.