APIs & Integrations

LanceH
Member

CRM API call for custom object values associated with a company

Given a company that has a custom object associated - how can I find the values applied in the object for that company?

 

I can get the schema of the custom object by calling https://api.hubapi.com/crm/v3/schemas/2-1669498.

 

The schema returned:

 

LanceH_0-1632884436587.png

 

I'm not sure what the next steps are to find the values applied in this object for a company.

0 Upvotes
3 Replies 3
LanceH
Member

CRM API call for custom object values associated with a company

Dropping the association filter, I do get all the custom object records returned. 

Is getting only the custom objects associated to a given company not possible? This reads like it isn't.

 

In the data retuned for all of the custom object results, there is nothing to identify which company it's associated with.

0 Upvotes
webdew
Guide | Diamond Partner
Guide | Diamond Partner

CRM API call for custom object values associated with a company

Hi @LanceH ,

Hope this will work :

Node JS :
var options = { method: 'POST',
url: 'https://api.hubapi.com/crm/v3/objects/<CUSTOM_OBJECT_ID>/search',
qs: { hapikey: <HUBSPOT_API_KEY> },
headers:
{
'Content-Type': 'application/json' },
body: {
"limit": 100,
"filterGroups":[
{
"filters":[
{
"propertyName": "associations.companies",
"operator": "EQ",
"value": "<COMPANY_ID>"
}
]
}
]
},
json: true };

request(options, function (error, response, body) {
if (error) throw new Error(error);

});


Hope this helps!


If we were able to answer your query, kindly help the community by marking it as a solution.

Thanks and Regards.

0 Upvotes
LanceH
Member

CRM API call for custom object values associated with a company

Appreciate the reply. Not quite there yet.

 

I've tried:

LanceH_0-1632946682251.png

Where $this->cURL is a PHP wrapper around a standard curl request. It's known to work for a similar setup with Deals.

Results in:

LanceH_2-1632946730935.png

 

I have tried with and without properties and limit. Same result.

I have tried without the second status=active filter. Same result.

I have tried changing associations.companies to associations.company. Same result.

I have tried with each of the values in the green comment as the custom-object-id. Results vary a bit as seen in comment.

 

0 Upvotes