Brian W. Spolarich
Brian W. Spolarich

Reputation: 11

Confluence - CQL Parse Error When Searching Labels with Hypens

I'm trying to use the Atlassian Cloud REST API to search for particular content in Confluence:

type = page and label = "change-model"

If I do something like this (no hyphen) it executes correctly (and returns zero results which is expected):

curl -v -u $USERNAME:$APITOKEN 'https://$MYSITE.atlassian.net/wiki/rest/api/content/search?cql=type=page+and+label=changemodel'

The same API call with 'change-model' instead of 'changemodel' returns:

{
  "statusCode": 400,
  "data": {
    "authorized": true,
    "valid": true,
    "errors": [],
    "successful": true
  },
  "message": "com.atlassian.confluence.api.service.exceptions.BadRequestException: Could not parse cql : "

I've tried various methods of escaping the hyphen and the search term, including single and double quotes, backslashes, and HTML ASCII codes. I've tried other CQL expressions, including searching other fields such as title, and they return expected results until the addition of the hyphen, which triggers the CQL parse error. What am I missing?

Upvotes: 0

Views: 38

Answers (0)

Related Questions