Back

Invalid query syntax

  • 0
  • Databases
  • REST API
  • Cloud
makeshyft_tom
27 Dec, 2024, 02:33

Hi,

My URL looks like this, using a simple query to list documents: ..... without query parameter, my listdocuments works correctly to return all documents ...

when I add queries url parameter, i get the syntax error .... "general query invalid" 400 error

My URL lookslike this ... selecting 3 attributes.

https://cloud.appwrite.io/v1/databases/.../collections/.../documents?queries[0]={\"method\":\"select\",\"values\":[\"claimedByEmail\",\"status\",\"licenseKey\"]}

As far as I can tell this follows the asked syntax perfectly.

Thank you in advance for any help.

TL;DR
Issue: Developer is encountering an "Invalid query syntax" error when adding a query parameter to their URL for listing documents. Solution: The query syntax in the URL is incorrect. To include queries, the correct format should be used. Instead of 'queries[0]={\"method\":\"select\",\"values\":[\"claimedByEmail\",\"status\",\"licenseKey\"]}', the correct format is 'filters=[{\"field\":\"fieldName\",\"operator\":\"=\",\"value\":\"fieldValue\"}]'. Adjust the query parameter in the URL accordingly for it to work correctly.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more