I’m trying to use the search API for tickets and contacts, but when trying to search for string values, I’m getting a “Validation failed” response:
Given query is invalid, expected format \“keyword:value OPERATOR keyword:‘string’ OPERATOR keyword:\“string\” OPERATOR keyword:>‘yyyy-mm-dd’ OPERATOR keyword:<integer\”. Space is mandatory between key/value pair and operator. Please check the paranthesis if there are any.",“code”:"invalid_value
As per this thread, I have wrapped my query parameter in escaped double-quotes in the requests.json file:
"searchTickets": {
"schema": {
"method": "GET",
"host": "<%= iparam.domain %>",
"path": "/api/v2/search/tickets",
"query": {
"query": "\"<%= context.query %>\""
},
"headers": {
"Authorization": "Basic <%= encode(iparam.api_key) %>",
"Content-Type": "application/json"
}
}
},
For a single word search, this works:
await client.request.invokeTemplate('searchTickets', { context: { query:`tag:Test` } });
however if I try to search for something with spaces, wrapping in single-quotes the client returns an error:
await client.request.invokeTemplate('searchTickets', { context: { query:`tag:'Test tag'` } });
I’ve tried various combinations of escaping and omitting the quotes and spaces, but nothing seems to work.
What’s curious is that the second example works locally when running the app via FDK. However once uploaded as a custom app I get the 400 error.