APIs & Integrations

tanmay
Miembro

CRM Search failing for double quotes not returning correct result set

Hi Team,

 

When I am using double quotes in CRM Search it is not returning correct result. Please find my details below -

Scenario-1: "propertyName": "deal_unique_id" i have used double quotes, didn't return correct result
----------------------------------------------------------------------------------------------------
Deal Search Input
{
"filterGroups": [
{
"filters": [
{
"propertyName": "oracle_account_number",
"operator": "EQ",
"value": "110192"
},
{
"propertyName": "enterprise_site_id",
"operator": "EQ",
"value": "114795"
},
{
"propertyName": "deal_unique_id",
"operator": "EQ",
"value": "114795-226--Sof-Tray Classic Sheets (0.035\\\")"
}
]
}
]
}
Deal Search Output
{
"total": 0,
"results": []
}

Scenario-2: I haven't used double quotes, did return correct result
------------------------------------------------------------------
Deal Search Input
{
"filterGroups": [
{
"filters": [
{
"propertyName": "oracle_account_number",
"operator": "EQ",
"value": "110192"
},
{
"propertyName": "enterprise_site_id",
"operator": "EQ",
"value": "114795"
}
]
}
]
}
Deal Search Output
{
"total": 1,
"results": [
{
"id": "2741226816",
"properties": {
"amount": null,
"closedate": null,
"createdate": "2020-07-31T21:00:04.034Z",
"dealname": "Sku:114795-226--Sof-Tray Classic Sheets (0.035\")",
"dealstage": null,
"hs_lastmodifieddate": "2020-07-31T21:00:11.900Z",
"hs_object_id": "2741226816",
"pipeline": null
},
"createdAt": "2020-07-31T21:00:04.034Z",
"updatedAt": "2020-07-31T21:00:11.900Z",
"archived": false
}
]
}

0 Me gusta
6 Respuestas 6
coaleb
Participante | Partner
Participante | Partner

CRM Search failing for double quotes not returning correct result set

Same exact problem. 2 years later and still not fixed. The API validation is ignoring the escape character unless you escape the escape character, which results in the string being 0.035\" instead of 0.035", which is why it will always result in an empty search.

0 Me gusta
WendyGoh
HubSpot Employee
HubSpot Employee

CRM Search failing for double quotes not returning correct result set

Hey @tanmay,

 

In order for me to further troubleshoot this, could you share with me the portal ID in question?

 

Additiionally, when comparing the POST body of scenario 1:

{
"filterGroups": [
{
"filters": [
{
"propertyName": "oracle_account_number",
"operator": "EQ",
"value": "110192"
},
{
"propertyName": "enterprise_site_id",
"operator": "EQ",
"value": "114795"
},
{
"propertyName": "deal_unique_id",
"operator": "EQ",
"value": "114795-226--Sof-Tray Classic Sheets (0.035\\\")"
}
]
}
]
}

and POST body of scenario 2 

{
"filterGroups": [
{
"filters": [
{
"propertyName": "oracle_account_number",
"operator": "EQ",
"value": "110192"
},
{
"propertyName": "enterprise_site_id",
"operator": "EQ",
"value": "114795"
}
]
}
]
}

I'm not seeing deal_unqiue_id used on scenario 2, hence by not using double quotes do you mean that you remove the search filter entirely? Or am I missing something here?

0 Me gusta
tanmay
Miembro

CRM Search failing for double quotes not returning correct result set

Secend scenerio i didn't use deal_unique_id becase i just wanted to show, whithout using deal_unique_id search result returning values.  

0 Me gusta
WendyGoh
HubSpot Employee
HubSpot Employee

CRM Search failing for double quotes not returning correct result set

Hey @tanmay

 

When I add this portion to the POST body:

{
"propertyName": "deal_unique_id",
"operator": "EQ",
"value": "114795-226--Sof-Tray Classic Sheets (0.035\\\")"
}

 

I'm also seeing a 400 error. 

 

When looking at the full error message:

 

message:"Api[name=crm-search, subPath=/crm-search/search] Failed to process your request. Error code was '400'. Error message was:\n{"status":"error","message":"Unknown Contacts Search API failure: [400] {\"status\":\"400\",\"message\":\"Unable to execute query. Property deal_unique_id could not be found.\",\"errorType\":\"INVALID_PROPERTY\",\"errorTokens\":{\"PROPERTY\":[\"deal_unique_id\"]},\"correlationId\":\"cfdef886-67af-4025-8c9a-546e76b93d15\"}","correlationId":"cfdef886-67af-4025-8c9a-546e76b93d15"}",

 

It seems to suggest that property `deal_unique_id` doesn't exist. 

 

As such, to further check on this, I used the CRM API | Properties 

GET /crm/v3/properties/contacts

 

and I wasn't able to locate property `deal_unique_id`. 

 

Since property `deal_unique_id` doesn't exist, it is expected that the search endpoint throw the 400 property not found error.

0 Me gusta
seedling
Miembro

CRM Search failing for double quotes not returning correct result set

Hi,

Actually i got same problem
You could reproduce it simply in API Doc page that HubSpot provide
https://developers.hubspot.com/docs/api/crm/products
Follow to search endpoin and in filter parameters section

- set hs_sku as a propertyName. The hs_sku is a default hubspot field.

- set to value the some string to search. Like hello " quote error.

- and make a test call.  

You will got response something like:

{
"status": "error",
"message": "Invalid input JSON on line 1, column 97: Cannot construct instance of `com.hubspot.inbounddb.publicobject.core.v3.search.Filter`, problem: Filter value 'Optional[hello " quote error]' has mismatched quotation marks",
"correlationId": "9c46f660-4f62-4d65-a3ee-ac647215bed2"
}

You can check that this call was send with escaped quote char, and got error!

Also, if you, try to do doble escape this quote char, then it API pass this, BUT it not found expected result.

 

So the problem still tere.

Btw the \u0022 encoding dont help. 

0 Me gusta
tanmay
Miembro

CRM Search failing for double quotes not returning correct result set

Hi Wendy,

I am using CRM search (https://developers.hubspot.com/docs/api/crm/search) and method = POST.

Please find my screen shot .

 

  1. I have created a product.
  2. I am searching the same product but returning 0 result.
  • Product created - 

ProductCreate.JPG

  • Product search returning 0 result -
  • ProductSearch.JPG
0 Me gusta