0

I am working with the following documentation to implement REST-based searching using Confluence CQL: https://developer.atlassian.com/confdev/confluence-rest-api/advanced-searching-using-cql and https://docs.atlassian.com/atlassian-confluence/REST/latest/#d3e648

I am able to do GET requests using the user id / password against other endpoints against my Confluence Cloud account. However, when I try to pass a CQL query to the search endpoint, as follows:

text ~ Tomcat

I get the following error:

{
    "statusCode":400,
    "data":
        {"authorized":false,"valid":true,"errors":[]},
        "message":"Could not parse cql : text %7E Tomcat"
}

Can anyone tell me what may be causing this? It looks like the CQL encoding for passing in HTTP GET is causing an error on the back end somehow. I am using Java to encode my GET parameters with UTF-8. This exact approach works just with with JIRA Cloud search using JIRA Query Language (JQL), so I'm confused what's going on here.

The endpoint I use is: https://mycompany.atlassian.net/confluence/rest/api/content/search?

I have tried it with HTTPS and HTTP. I understand that for the search endpoint, a 400 response means "Returned if the CQL is invalid or missing" - any ideas what I'm missing here or what may be wrong with my CQL?

Prometheus
  • 1,148
  • 14
  • 21
rc1
  • 483
  • 4
  • 19

1 Answers1

0

The authorization error is caused by you not being logged into your confluence instance... Try logging in and use a url like this one (in some instances the confluence/ isn't needed)

https://mycompany.atlassian.net/confluence/rest/api/content/search?cql=space=DS