APIs & Integrations

SRamosBarroso
Member

Is there a way to search for contacts by filtering by associatedcompanyid field?

SOLVE

 

Hi,

 

Is there a way to search for contacts by filtering by "associatedcompanyid" field?

 

Actually I'm using this endpoint: POST /crm/v3/objects/contacts/search

 

with this body:

 

 

{
    "filterGroups": [
        {
            "filters": [
                {
                    "operator": "EQ",
                    "propertyName": "associatedcompanyid",
                    "value": "4972672985"
                }
            ]
        }
    ]
}

 

 

 

 

But it returns 0 results

Thanks

0 Upvotes
1 Accepted solution
RMones
Solution
Contributor | Platinum Partner
Contributor | Platinum Partner

Is there a way to search for contacts by filtering by associatedcompanyid field?

SOLVE

Hi @SRamosBarroso ,

 

Try it with the following payload:

Associations
Search for records that are associated with other specific records by using the pseudo-property associations.{objectType}.

For example, the request below searches for all tickets associated with a contact that has the contact ID of 123:

{
    "filters": [
      {
        "propertyName": "associations.contact",
        "operator": "EQ",
        "value": "123"
      }
    ]
  }
You can search through associations by using the following pseudo-property values:

associations.company
associations.contact
associations.ticket
associations.deal
associations.quote
To search for associations to a specific custom object record, you can use use the above pseudo--property with the custom object's objectTypeId, which you can retrieve through the custom object's schema. For example, associations.2-214573.

 

I found this information at https://developers.hubspot.com/docs/api/crm/search

 

Regards Ronald

View solution in original post

1 Reply 1
RMones
Solution
Contributor | Platinum Partner
Contributor | Platinum Partner

Is there a way to search for contacts by filtering by associatedcompanyid field?

SOLVE

Hi @SRamosBarroso ,

 

Try it with the following payload:

Associations
Search for records that are associated with other specific records by using the pseudo-property associations.{objectType}.

For example, the request below searches for all tickets associated with a contact that has the contact ID of 123:

{
    "filters": [
      {
        "propertyName": "associations.contact",
        "operator": "EQ",
        "value": "123"
      }
    ]
  }
You can search through associations by using the following pseudo-property values:

associations.company
associations.contact
associations.ticket
associations.deal
associations.quote
To search for associations to a specific custom object record, you can use use the above pseudo--property with the custom object's objectTypeId, which you can retrieve through the custom object's schema. For example, associations.2-214573.

 

I found this information at https://developers.hubspot.com/docs/api/crm/search

 

Regards Ronald