Problems with CQL search and expands

I currently try to search (Custom Content) and want to expand comments and labels.
I found these expandable fields in the REST API documentation:

The search itself works find, but I am struggling expanding these fields. It seems the expand parameter is completely ignored.

This what my request looks like /wiki/rest/api/search?expand=body.view,metadata.labels,children.comment&limit=5&start=0&cql=text~"foo*"+AND+space=DEMO+AND+label=bar+order+by+lastmodified+desc

I assume there is something wrong with my request. Does anyone spot the error?

1 Like

Hi @ppasler,

I think you got two different endpoints mixed up wherein you are using Search content API (/wiki/rest/api/search) but the expand query parameter values used are for Search content by CQL (/wiki/rest/api/content/search).

Can you try one of these options and see if it addresses the question:

  1. Retain the query parameters but use /wiki/rest/api/content/search; notice the additional /content in the endpoint, or
  2. Retain the same endpoint but update the expand query parameter to expand=content.body.view,content.metadata.labels,content.children.comment

Hope this helps.
Ian

3 Likes

Hi Ian,

thanks for your answer. What a dumb mistake :slight_smile:
I can confirm, that both suggestions work!

Cheers paul

2 Likes