APIs & Integrations

EJoyce2
Participant

Not getting custom object association with API from deal

I created a custom object that I associated both ways with deals. 

 

"associations": [
{
"fromObjectTypeId": "2-1539283",
"toObjectTypeId": "0-3",
"name": "sei_consultant_to_deal",
"cardinality": "ONE_TO_MANY",
"inverseCardinality": "ONE_TO_MANY",
"id": "49",
"createdAt": null,
"updatedAt": null
},
{
"fromObjectTypeId": "0-3",
"toObjectTypeId": "2-1539283",
"name": "sei_consultant_to_deal",
"cardinality": "ONE_TO_MANY",
"inverseCardinality": "ONE_TO_MANY",
"id": "50",
"createdAt": null,
"updatedAt": null
},

 

I am trying to pull all deals from HubSpot with the association of the custom object. When I pull the deals and have includeAssociations=true, it still does not output the custom object association. It does return the rest, 

associations.associatedVids
associations.associatedCompanyIds
associations.associatedDealIds
associations.associatedTicketIds  

 How do I make the association to custom object be included in the get return as well through API? using python

0 Upvotes
2 Replies 2
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Not getting custom object association with API from deal

Hi @EJoyce2 ,

Please use the below code for association :

POST call to https://api.hubapi.com/crm/v3/schemas/<custom-object-id>/associations?hapikey=demo

Object JSON :
{
"fromObjectTypeId": "<custom-object-id>",
"toObjectTypeId": "0-3",
"name": "customobject_to_deal",
"cardinality": "ONE_TO_MANY",
"inverseCardinality": "ONE_TO_ONE"
}

Followed this link for Schema : https://developers.hubspot.com/blog/introducing-custom-objects-for-hubspot

Hope this helps!


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

Thanks and Regards.

natsumimori
Community Manager
Community Manager

Not getting custom object association with API from deal

Thank you for your post @EJoyce2 .

 

@tominal , would you mind sharing your advice here?

0 Upvotes