I'm experiencing an issue when using the Intercom API to search for tickets. When I try to search for a title that contains spaces, the API does not return the expected results. For example:
-
The query below returns the ticket correctly:
{ "query": { "field": "title", "operator": "~", "value": "Atraso" } }
-
However, when I add a space after "Atraso", no results are returned:
{ "query": { "field": "title", "operator": "~", "value": "Atraso " } }
I have already tried the following approaches without success:
-
Using regular expressions with
\b
-
Encoding the space as
%20
-
Using the exact match operator "="
Expected result :
[ { "type": "ticket.list", "pages": { "type": "pages", "page": 1, "per_page": 20, "total_pages": 1 }, "total_count": 1, "tickets": [ { "type": "ticket", "id": "9", "ticket_id": "3", "ticket_attributes": { "_default_title_": "Atraso na criação de atividades no Pipedrive", "_default_description_": "Solicitação de análise urgente de atraso na criação de atividades no Pipedrive, impactando a organização do time. Cliente aguarda retorno sobre a resolução do problema.", ...
Endpoint of this request:
https://api.intercom.io/tickets/search
Docs of this API application:
https://developers.intercom.com/docs/references/2.10/rest-api/api.intercom.io/tickets/searchtickets
The expected behavior would be for the API to return results even with extra spaces. How can I resolve this issue to effectively search for ticket titles containing spaces?