Hello, when I try to api call to delete an association I have between my objects Contact and Event I get this error:
Invalid input JSON on line 1, column 62: Cannot deserialize value of type `java.util.ArrayList<com.hubspot.apiutils.core.models.PublicObjectId>` from Object value (token `JsonToken.START_OBJECT`)
My jsonString:
[
{
“from”: {
“id”: “80674213188”
},
“to”: {
“id”: “20226914952”
}
}
]
@DGrant5 - I think you may be missing the ‘inputs’ JSON array element on the structure here. My read is that the structure should be:
{
"inputs": [
{
"from": {
"id": "string"
},
"to": [
{
"id": "string"
}
]
}
]
}
Best of luck!
Steve
GRajput
December 4, 2024, 12:26pm
3
Hi @DGrant5
here is the curl to delete the association between 2 objects.
curl --request POST \
--url https://api.hubapi.com/crm/v4/associations/fromObjectType/toObjectType/batch/labels/archive \
--header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--data '{
"inputs": [
{
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 0
}
],
"from": {
"id": "string"
},
"to": {
"id": "string"
}
}
]
}'
link address -
Accounts Dashboard | HubSpot
make sure you use the correct association type and correct ID
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!