La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
api v3 associations: are constants defined for "associationType"?
Résolue
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 associationType parameter in the HubSpot CRM objects API. In particular, I am using the endpoint below to associate a deal with a company:
PUT /crm/v3/objects/deals/{dealId}/associations/{toObjectType}/{toObjectId}/{associationType}
The PHP library defines constants that satisfy the requirements for the toObjectType parameter:
namespace: HubSpot\Crm
class: ObjectType
example: \HubSpot\Crm\ObjectType::DEALS
However, I am unable to find any constants in the PHP library that may help with the associationType parameter. I can guess that the string I need will be something like "deal_to_company" but would rather not have to guess.
This is the PHP API that I am trying to implement:
api v3 associations: are constants defined for "associationType"?
Résolue
The Associations API v3 has an endpoint that will allow you to query the system and ask what types of associations are available between a pair of CRM objects:
Please note that the association returned is direction specific. You can get the id and name of the association type going the other direction by swapping the {fromObjectType} and {toObjectType} properties.
api v3 associations: are constants defined for "associationType"?
Résolue
The Associations API v3 has an endpoint that will allow you to query the system and ask what types of associations are available between a pair of CRM objects:
Please note that the association returned is direction specific. You can get the id and name of the association type going the other direction by swapping the {fromObjectType} and {toObjectType} properties.
Looking at the page https://developers.hubspot.com/docs/api/crm/deals you provided, from the json response in the example the value "contact_to_company" is used. So yes, please go ahead and try "deal_to_company" 🙏
I don't think there is gonna be a list of standardarized values for the association types that API v3 expects, basically it's a "Discovery" like architecture.
I can't tell you as I didn't test but looking at your previous ticket,in case the plural version is working ( 'deals_to_companies' ), you could might give a try with : \HubSpot\Crm\ObjectType::DEALS . '_to_' . HubSpot\Crm\ObjectType::COMPANIES (or something similar)
If anyone has a feedback or opinion on the subject, you are welcome to share it the community 😃
{
"message":"[400] Client error: `PUT https://api.hubapi.com/crm/v3/objects/contacts/88141351/associations/companies/2410836413/contacts_to_companies?paginateAssociations=&hapikey=XXX` resulted in a `400 Bad Request`"
}
{
"response":{
"status":"error",
"message":"contacts_to_companies is not a valid association type between contacts and companies"
}
I manually changed the association type to "Contact_to_Company" and the API seemed to work.
It would be nice if we didn't have to guess at the values for these undocumented constants.