Hi Kevin - thank you for the feedback and guidance. I did the get request for my custom object and was given the following:
{
“fromObjectTypeId”: “2-13328406”,
“toObjectTypeId”: “0-46”,
“name”: “flip_projects_to_note”,
“cardinality”: “ONE_TO_MANY”,
“inverseCardinality”: “ONE_TO_MANY”,
“id”: “79”,
“createdAt”: null,
“updatedAt”: null
},
{
“fromObjectTypeId”: “0-46”,
“toObjectTypeId”: “2-13328406”,
“name”: “flip_projects_to_note”,
“cardinality”: “ONE_TO_MANY”,
“inverseCardinality”: “ONE_TO_MANY”,
“id”: “80”,
“createdAt”: null,
“updatedAt”: null
}
My objective is to post a note to my custom object. I tried the following post request:
{
“properties”: {
“hs_timestamp”: “2023-04-17T15:48:22Z”,
“hs_note_body”: “Here’s my sample note. This is just a test.”,
“hubspot_owner_id”: “349248903”
},
“associations”: [
{
“to”: {
“id”:13042541752
},
“types”: [
{
“associationCategory”: “HUBSPOT_DEFINED”,
“associationTypeId”: 12
}
]
},
{
“from”: {
“objectTypeId”: “0-46”
},
“to”: {
“objectTypeId”:“2-13328406”,
“id”: 6018585414
},
“types”: [
{
“associationCategory”: “HUBSPOT_DEFINED”,
“associationTypeId”: 80
}
]
}
]
}
Whether I use the association type ID of 79 or 80, I always get a resposne similiar to this (here is my response using the association type ID of 80):
{
“status”: “error”,
“message”: “invalid from object type 0-46 for associations to be created. expected: 0-15”,
“correlationId”: “f59d5055-d8f7-42b1-90f5-0fb80573033a”,
“category”: “VALIDATION_ERROR”
}
I’m by no means proficient in this space as I am recently self-taught, so I’m sure I have a handful of errors. Any help would be greatly appreciated. Thanks!
@Kevin-C wrote:
Hey @RLeonard
First check your custom object’s schema using:
GET
/crm/v3/schemas/{objectType}
If the association to notes is present, it will list the association direction ids.
If not you’ll want to update the schema to include the NOTES associtaion by patching the schema:
POST
/crm/v3/schemas/{objectType}/associations
Hope this gets you moving!