APIs & Integrations

BBirch6
Membre

API pull of data through association tied to custom object

Résolue

We are struggling to integrate with a third party vendor for SSO, I need to understand how can we pull data from a custom object through an association to a company or contact record...in our use case, we need to query about the membership status as an individual in the system, the membership truth is housed on our Membership custom object, tied to the Company via an association...so we need to drill from Contact>>Primary Company>>Membership (custom object) etc.

 

How do we query from say a ContactID to get at whether their Primary company has Membership association (and drill into that object data as well as needed)?

0 Votes
1 Solution acceptée
Teun
Solution
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

API pull of data through association tied to custom object

Résolue

Hi @BBirch6 ,

 

You can make an GET API call to the contacts endpoint to retrieve the properties of that specific contact. You can simply pass ?associations=companies in the URL to get the associated companies in that response as well. It will also state the association types, so its quite easy to retrieve the primary company.

Once you have the ID of the primary company, you can make a second GET request to the companies endpoint and pass the ?associations=memberships in that call. That will give you the ID of the associated membership record. (The internal name of your custom object might be different). Once you have the ID of the membership record, you can make your final API call to retrieve that records properties to the custom object endpoint.

Another approach is to use a GraphQL query to retrieve all that data in a single API call.

 

Hope this helps!



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Voir la solution dans l'envoi d'origine

0 Votes
1 Réponse
Teun
Solution
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

API pull of data through association tied to custom object

Résolue

Hi @BBirch6 ,

 

You can make an GET API call to the contacts endpoint to retrieve the properties of that specific contact. You can simply pass ?associations=companies in the URL to get the associated companies in that response as well. It will also state the association types, so its quite easy to retrieve the primary company.

Once you have the ID of the primary company, you can make a second GET request to the companies endpoint and pass the ?associations=memberships in that call. That will give you the ID of the associated membership record. (The internal name of your custom object might be different). Once you have the ID of the membership record, you can make your final API call to retrieve that records properties to the custom object endpoint.

Another approach is to use a GraphQL query to retrieve all that data in a single API call.

 

Hope this helps!



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Votes