Create a note and attach to a ticket via api

I’m trying to create a note and attach it to a particular ticket via api. According to the documentation I’m making the following api call.

api.hubapi.com/crm/v3/objects/notes

request body

{

“properties”: {

“hs_attachment_ids”: “106842206053”,

“hs_note_body”: “Test create note via api”,

“hs_timestamp”: “2023-03-17T01:12:17.883Z”

},

“associations”: [

{

“to”: {

“id”: 1500392495

},

“types”: [

{

“associationCategory”: “HUBSPOT_DEFINED”,

“associationTypeId”: 227

}

]

}

]

}

I got the association type by doing following api call

api.hubapi.com/crm/v3/associations/Ticket/Note/types

I get following error

{

“status”: “error”,

“message”: “invalid from object type 0-46 for associations to be created. expected: 0-5”,

“correlationId”: “7fcb3284-4c02-46dd-926a-0713762e2bcf”,

“category”: “VALIDATION_ERROR”

}

What am I doing wrong here?

Hey, @ravindasenarath One thing to note about these labels is that they are unidirectional, or one-way.

Can you try making a request to the label type endpoint that looks like this, please?

/crm/v4/associations/note/ticket/labels

Which should return a response of:

{
 "results": [
 {
 "category": "HUBSPOT_DEFINED",
 "typeId": 228,
 "label": null
 }
 ]
}

This is because the call you are making to the Notes endpoint is going from Notes to Tickets and not Tickets to Notes.

Have fun building! — Jaycee

Solves the problem. Thanks @Jaycee_Lewis :hugs: