REST API /query like operator examples

Hello!

I try to use method “query” via REST API https://server:port/rest/wikis/xwiki/query?q=query_string&type=xwql (https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiRESTfulAPI#HRootresources)

with opertor “like” by example in https://extensions.xwiki.org/xwiki/bin/view/Extension/Query%20Module

where doc.object(XWiki.XWikiUsers).email like '%xwiki.com' and doc.object(XWiki.ArticleClass).content like '%ludovic%'

But i get server error:

Type Exception Report

Message Invalid URL [https://server:port/rest/wikis/xwiki/query?q=where%20doc.object(XWiki.XWikiUsers).email%20like%20%xwiki.com&type=xwql]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

How to correctly form a request using the “like” operator?

Well the error message is pretty explicit: what you use is simply not a valid URL, you have a % sitting alone just before xwiki.com.

yes, and how is right?

You should probably use a tool to properly escape the values you want to put in your URL. You can find a lot of those online, see for example https://www.urlencoder.org/.

You should probably use a tool to properly escape the values you want to put in your URL

Thanks!