I’m just trying to create a note using the engagement api, I’ve looked at examples and it should work but I keep getting the error:
Invalid input JSON on line 8, column 21: Cannot deserialize value of type `java.util.ArrayList<com.hubspot.crmpublic.core.models.associations.PublicAssociationsForObject>` from Object value (token `JsonToken.START_OBJECT`)
this is my payload:
{
“engagement”: {
“active”: true,
“ownerId”: 251,
“type”: “NOTE”,
“timestamp”: 1409172644778
},
“associations”: {
“contactIds”: [
251
],
“companyIds”: [],
“dealIds”: [],
“ownerIds”: []
},
“metadata”: {
“body”: “this is an example note”
}
}
Any help would be most appreciated - thanks
Hello @SBircher
It look like error you received indicates that there is an issue with deserializing the JSON payload you provided. Specifically, it looks like there is an issue with the associations field. Based on the error message, it seems that the API is expecting an array of PublicAssociationsForObject, but instead it received a JSON object.
To fix this issue, you may need to update your payload to include an array for the contactIds field:
{
"engagement": {
"active": true,
"ownerId": 251,
"type": "NOTE",
"timestamp": 1409172644778
},
"associations": {
"contactIds": [ 251 ],
"companyIds": [],
"dealIds": [],
"ownerIds": []
},
"metadata": {
"body": "this is an example note"
}
}
Note that the contactIds field now includes an array with a single value, instead of a single value. This should help the API properly deserialize your payload.
Thanks & Regards
Himanshu Rauthan
Thanks for the reply Himanshu - I’ll give it a go later