Unable to search string values with spaces

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.

Hi @sodadreamer

I have reported this to the FW team as I have the same issue. I also tried encoding a string in the path. That works in dev environment but not when you upload it as custom app.

@Nadeem_Bhati @zach_jones_noel @Saif - Chris is having the same issue as the one we have been discussing.

Hey @sodadreamer

Let me DM for some details.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.