question

Anton Astashov avatar image
Anton Astashov asked

What are the rules for escaping characters in 'filters' param?

Hello, Let's say I want to filter for children with name "? : @ & = + ' " $". How should I escape that 'filters' value? Without escaping it doesn't work, .e.g for the request: https://cdws.us-east-1.amazonaws.com/drive/v1/nodes/nodeId/children?filters=name:? : @ & = + ' " $ It returns 'Invalid filter:name', even if I have a folder with that name as a children of a node 'nodeId'. Thanks!
amazon drive
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

yadayada avatar image
yadayada answered
The colon can be escaped with a backslash. Some of these characters can be 'escaped' by replacing them with an escaped whitespace. Multiple special characters sometimes may get condensed. I tried a few times and could match "foo$%^bar" by filtering for "foo\ bar". The behaviour is not always predictable. You might be better off filtering manually.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Anton Astashov avatar image
Anton Astashov answered
Wow, this is reaaaally bad. Hey, Amazon team, any plans on fixing that or providing documentation how to escape 'filters' param?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jamie Grossman avatar image
Jamie Grossman answered
Hi there, It looks like our API documentation doesn't list what to do with escaping characters in filters. We will ensure that these are added as soon as possible. However, the following should describe what to do with escaping characters: CDS Supports escaping special characters that are part of the query syntax. The current list special characters are: + - && || ! ( ) { } [ ] ^ " ~ * ? : \ To escape these character use the \ before the character. Hope this helps! Jamie
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.