Hi, I am currently trying to create a task and associate it with a contact and company using the endpoint
https://api.hubapi.com/crm/v3/objects/tasks
The problem I’m facing is that according to the Associations v4 documentation, to associate an object with contact, the code is 203, but in the example request in the Tasks documentation, for associate it with a contact it uses 204.
If I use 203 the endpoint response is:
{
"status": "error",
"message": "invalid from object type 0-27 for associations to be created. expected: 0-2",
"correlationId": "295599d8-2f54-4b18-b727-45764445aa1a",
"category": "VALIDATION\_ERROR"
}
If I use 204, it creates the task perfectly, so the error may be in the Associations v4 documentation.
My current request is this, I am getting the same error as before, and I think the reason is the code 191 for company, it should be another code.
{
“properties”: {
"hs\_timestamp": "2023-07-12T13:30:17.883Z",
"hs\_task\_body": "trying to execute this endpoint",
"hubspot\_owner\_id": "165887603",
"hs\_task\_subject": "Talk to an executive",
"hs\_task\_status": "NOT\_STARTED",
"hs\_task\_priority": "HIGH",
"hs\_task\_type":"TODO"
},
“associations”: [
{
"to": {
"id": "11227351"
},
"types": \[
{
"associationCategory": "HUBSPOT\_DEFINED",
"associationTypeId": 204
} ]
},
{
"to": {
"id": "6126491292"
},
"types": \[
{
"associationCategory": "HUBSPOT\_DEFINED",
"associationTypeId": 191
} ]
}
]
}
Thanks and I hope someone faced this problem before and is able to help me.