dchou
9 years agoAce
LIQL queries and white spaces in freemarker
If I'm in the Studio option and go to the API call (LIQL) i can create a query such as:
SELECT * FROM messages WHERE labels.text = "Hello World"
This would return results correctly. But if i were to use
<#assign x= rest("2.0b","/search?q=" + "SELECT * FROM messages WHERE labels.text = "Hello World"?url) />
It would show empty results. I'm assuming this is because the URL renders %20 for the whitespace. Is there anyway to work around this?
Thanks
Hi dchou,
I made a slight tweak to your freemarker LiQL call and it worked for me on the site I tested on:
<#assign x = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE labels.text = 'Hello World'"?url) />
The Query should get URL decoded before it's run, so the url-encoded space should be ok.
Let me know if that changed query works for you or not.
-Doug