Hi Team , In V4 Association, Custom object and standard object not getting associated .

Tried following end point :

--------------------------------

/crm/v4/associations/{fromObjectType}/{toObjectType}/batch/create

Getting below validation error , Need your advice here.

Hi @Yasar :waving_hand:

Would you please share additional information about your request (text format would be helpful):

  • Endpoint URL and method
  • Headers
  • Request Body JSON
  • Response Body JSON

Hi @zach_threadint

END Point URL :
--------------------

/crm/v4/associations/{fromObjectType}/{toObjectType}/batch/create

https://api.hubapi.com/crm/v4/associations/Companies/2-18323995/batch/create

--header ‘content-type: application/json’

Request Body :
------------------

{
“inputs”: [
{
“types”: [
{
“associationCategory”: “USER_DEFINED”,
“associationTypeId”: 155
}
],
“from”: {
“id”: “17168177704”
},
“to”: {
“id”: “18323995”
}
}
]
}

Response Body :
------------------

{
“status”: “COMPLETE”,
“results”: [],
“numErrors”: 1,
“errors”: [
{
“status”: “error”,
“category”: “VALIDATION_ERROR”,
“message”: “2-18323995=18323995 is not valid”
}
],
“startedAt”: “2024-02-15T05:02:57.517Z”,
“completedAt”: “2024-02-15T05:02:57.548Z”
}

Hi @Yasar :waving_hand:

Thanks for coming back with more information regarding your request.

This error message suggests that for custom object type “2-18323995”, there’s no record with ID “18323995” (or maybe this record has been deleted/archived).

I hope this proves useful. Please let me know if you have any follow-up questions.

Hi @zach_threadint ,

We have tried with a different custom object also but this time also we are getting error message in the response.

Request:

'https://api.hubapi.com/crm/v4/associations/company/2-18323835/batch/create’

{
“inputs”: [
{
“types”: [
{
“associationCategory”: “USER_DEFINED”,
“associationTypeId”: 162
}
],
“from”: {
“id”: “16726619290”
},
“to”: {
“id”: “18323835”
}
}
]
}

Response:

{
“status”: “error”,
“message”: “One or more association types in request don’t match specified object types & direction: company → employees”,
“correlationId”: “d930d4e9-502a-454c-bf98-033efb0d0ea8”,
“context”: {
“USER_DEFINED”: [
“162”
]
},
“category”: “VALIDATION_ERROR”
}

PREVIEW

Hi @Yasar :waving_hand:

Association types are directional, meaning they have a “from” object-type and a “to” object-type. You’ve attempted to create an association from a Company (first object type in your request URL) to an Employee [Custom Object] (second object type in your request URL). The error message you received suggests that your USER_DEFINED association type 162 does not match your attempted create association request.

I hope this proves useful. Please let me know if you have any follow-up questions.

HI @ zach_threadint ,

END Point URL :
----------------

/crm/v4/associations/{fromObjectType}/{toObjectType}/batch/create

https://api.hubapi.com/crm/v4/associations/Companies/2-18323995/batch/create

--header ‘content-type: application/json’

Request Body :
-------------

{
“inputs”: [
{
“types”: [
{
“associationCategory”: “USER_DEFINED”,
“associationTypeId”: 155
}
],
“from”: {
“id”: “17168177704”
},
“to”: {
“id”: “18323995”
}
}
]
}

Response Body :
---------------

{
“status”: “COMPLETE”,
“results”: [],
“numErrors”: 1,
“errors”: [
{
“status”: “error”,
“category”: “VALIDATION_ERROR”,
“message”: “2-18323995=18323995 is not valid”
}
],
“startedAt”: “2024-02-15T05:02:57.517Z”,
“completedAt”: “2024-02-15T05:02:57.548Z”
}

Hi @zach_threadint & Team,

Please update on the above thread .

Thanks