Confluence - URL encoding is failing for CQL

Hi All,

I am trying to encode the following URL with UTF-8 and tried to execute, but I got the “BadRequest” response.>="2021/10/01 19:57" AND lastmodified<"2022/02/18 06:56"&expand=version,history.previousVersion

Version 1:

Version 2:

Neither of the above have worked.

May I know the correct way to format the query url?


Hello @Ravi90

The encoded version of the space character is %20, not + (plus sign).

Do a Google search for HTML URL encoding for numerous articles on the topic.

ok thanks @sunnyape, will check.


Hi @Ravi90 ,

The URL encoding of lastmodified >= "2021/10/01 19:57" AND lastmodified < "2022/02/18 06:56" is lastmodified%20%3E%3D%20%222021%2F10%2F01%2019%3A57%22%20AND%20lastmodified%20%3C%20%222022%2F02%2F18%2006%3A56%22 so try invoking with:>%3D%20"2021%2F10%2F01%2019%3A57"%20AND%20lastmodified%20<%20"2022%2F02%2F18%2006%3A56"&expand=version,history.previousVersion

Most tech stacks provide utilities to encode URLs. For example, for Javascript you would call encodeURIComponent('lastmodified >= "2021/10/01 19:57" AND lastmodified < "2022/02/18 06:56"'). See encodeURIComponent() - JavaScript | MDN.


1 Like

ok thanks @dmorrow