Hi,
Our company want to use search api by assocition, but the response don’t have association properties info.
For example:
we use api /crm/v3/objects/quotes/search to find quotes list by deal ids, request body like:
{
"filterGroups": [
{
"filters": [
{
"values": ["123456","234567"],
"propertyName": "associations.deal",
"operator": "IN"
}
]
}
],
"sorts": [
"name"
],
"properties": [
"hubspot_owner_id",
"hs_title",
"hs_domain",
"hs_currency",
"associations.deal.id" <-- it doesn't work
],
"limit": 10,
"after": 0
}
response info is :
{
"total": 1,
"results": [
{
"id": "2222222",
"properties": {
"hs_createdate": "2022-02-04T06:34:16.316Z",
"hs_currency": "USD",
"hs_domain": null,
"hs_lastmodifieddate": "2023-06-23T07:14:07.905Z",
"hs_title": "aaa",
"hubspot_owner_id": "1111111"
},
"createdAt": "2022-02-04T06:34:16.316Z",
"updatedAt": "2023-06-23T07:14:07.905Z",
"archived": false
}
]
}
This does not return the associated deal id information. We can’t tell which deal the returned quotation belongs to.How to solve this problem?
Hi @jasoncheng 
As per this HubSpot API doc, when using the “pseudo-property associations.{objectType}”, the records returned by the CRM Search API will still only relate to the object-type specified in the request URL (e.g. only data relating to Quotes will be returned when calling https://api.hubapi.com/crm/v3/objects/[u]**QUOTE**[/u]/search). Likewise, the “properties” specified in your request body relate only to Quote properties, not associated Deal properties. The CRM Search API simply ignores any non-valid property names, which is why your request still succeeds.
The approach you’ll need to take will be similar to the accepted solution in this community post. In short:
- Perform a CRM Search to return Quotes that are associated with your target Deals (as per the example request you’ve supplied).
- Use the returned Quote ID(s) from Step 1 to read a batch of associations, relating to associated Deals.
- Use the returned Deal ID(s) from Step 2 to read a batch of Deals (returning your target Deal property values by using the request query string parameter “properties”).
I know it’s frustrating that you have to perform multiple requests to get the information you’re looking for, but, as far as I’m aware, this is still the most efficient way to do it.
I hope this proves helpful.