APIs & Integrations

RReiffer
Contributor

Issue with filters on search API - filters not handling JSON escaped text

I have been running a search using 

/crm/v3/objects/deals/search

and the filter as follows:

{
    "filterGroups":[
      {
        "filters":[
          {
            "propertyName": "dealname",
            "operator": "EQ",
            "value": "{{ CTX.opp_name }}"
          }
        ]
      }
    ]
  }
 
Now this works EXCEPT when the variable CTX.opp_name contains a single quote as it will error out.  I then changed it so the variable was set this way CTX.opp_name|json_escape.   It then runs BUT the search will NOT find anything.  It's like the API is ignoring the escaped character and not feeding it to the actual internal search.
 
The actual string was as follows:
 
"Test Quote for a 50" TV"
 
The escaped JSON string was 
 
"Test Quote for a 50\" TV"
 
Now in other areas I can escape the text just fine, just not in the search.
0 Upvotes
1 Reply 1
RReiffer
Contributor

Issue with filters on search API - filters not handling JSON escaped text

I have tried the double "" method and several other methods of pre-encoding the string (including standard escapes and Microsoft based ones) - the issue is at some point the API point takes the "converted" string but it then can not find the deal by name even though it exists.  From what I have read it appears that the filter command on HubSpot API searches does not process JSON escape or any other escape method for that matter.