Mar 22, 2021 2:29 PM
I have been searching through the API v3 documentation but have not been able to find a list of valid strings that would satisfy the fromObjectType or toObjectType parameters of the HubSpot CRM Associations API.
https://developers.hubspot.com/docs/api/crm/associations
I am also interested in using the HubSpot CRM Companies API to fetch deals associated with a given company.
https://developers.hubspot.com/docs/api/crm/companies
I am using the Hubspot API library in PHP to query the v3 endpoints, but the PHP library also does not provide a definitions list or set of constants. All of the to_object_type and from_object_type parameters are simply defined as string variables without a closed list of options or reference to allowed constants.
language: PHP
namespace: HubSpot\Client\Crm\Companies\Api
class: AssociationsApi
method: getAll
Could someone point me to where I can find a list of allowed association values? I am unsure of whether to use "deal" or "deals" or "company" or "companies" and would rather not have to guess my way through trial and error to determine which association values are valid.
Solved! Go to Solution.
Mar 23, 2021 12:35 PM
Hey @dennisedson ,
Sorry to disappoint you but I'm not using the V3 of the API. On my side I'm still using the legacy API. 😜
@danhammari
If you are using the new API V3 I *guess* it's one of the "string" described in this reference file :
https://github.com/HubSpot/hubspot-api-php/blob/master/lib/Crm/ObjectType.php
If you are using the legacy API it's probably an integer as described in this reference file :
https://github.com/HubSpot/hubspot-php/blob/master/src/Resources/CrmAssociations.php
$hubspot->CrmAssociations()->get( {an object id}, {a from2object type id} );
Hope this help. 😃
Mar 23, 2021 12:35 PM
Hey @dennisedson ,
Sorry to disappoint you but I'm not using the V3 of the API. On my side I'm still using the legacy API. 😜
@danhammari
If you are using the new API V3 I *guess* it's one of the "string" described in this reference file :
https://github.com/HubSpot/hubspot-api-php/blob/master/lib/Crm/ObjectType.php
If you are using the legacy API it's probably an integer as described in this reference file :
https://github.com/HubSpot/hubspot-php/blob/master/src/Resources/CrmAssociations.php
$hubspot->CrmAssociations()->get( {an object id}, {a from2object type id} );
Hope this help. 😃
Mar 23, 2021 3:40 PM
Hi ph_alti_trading,
Thanks for pointing out the ObjectType.php file. I tested using both the plural and singular versions of each term (e.g. company/companies, deal/deals) and found that the API was able to treat the singular and plural variants of each entity without distinction. I guess the API designers thought through the possibility that users would provide either term and allowed the API to handle them without error.
Meanwhile, I will use the ObjectType.php file as the source of my constants when I am scripting my association queries:
namespace: HubSpot\Crm
class: ObjectType
example: $hubspot_api_company_helper->associationsApi()->getAll( $hubspot_company_id, \HubSpot\Crm\ObjectType::DEALS );
Mar 23, 2021 12:37 PM
Mar 23, 2021 12:12 PM
Hey @danhammari ,
I am going to throw a bunch of folks at this for you
@quentin_lamamy , @philx , @AndrewFisher , @twnk , @ph_alti_trading could any of you all help out here?