I am attempting to delete an association label between companies and a custom entity.
From Postman, the following works successfully:
POST https://api.hubapi.com/crm/v4/associations/2-122116974/0-2/batch/labels/archive
{
"inputs": [
{
"types": [
{
"associationCategory": "USER_DEFINED",
"associationTypeId": 81
}
],
"from": {
"id": "3123974637"
},
"to": {
"id": "6003640801"
}
}
]
}
When I attemp to do this in NodeJS, I get a response of 204, but the code does not seem to have an effect:
const hubspot = require('@hubspot/api-client');
const hubspotClient = new hubspot.Client({"accessToken":"YOUR_ACCESS_TOKEN"});
const BatchInputPublicAssociationMultiPost = { inputs: [{"types":[{"associationCategory":"HUBSPOT_DEFINED","associationTypeId":81}],"_from":{"id":"3123974637"},"to":{"id":"6003640801"}}] };
const fromObjectType = "2-122116974";
const toObjectType = "0-2";
try {
const apiResponse = await hubspotClient.crm.associations.v4.batchApi.archiveLabels(fromObjectType, toObjectType, BatchInputPublicAssociationMultiPost);
console.log(JSON.stringify(apiResponse, null, 2));
} catch (e) {
e.message === 'HTTP request failed'
? console.error(JSON.stringify(e.response, null, 2))
: console.error(e)
}