Batch Association Create Method Is Not Working in API V3 (Returns Empty Array in Results)

I’m working on a nodejs application and integrating hubspot in it.

While creating association between multiple contacts to a single company, it returns an empty array as result.

I’m referring to these documentation.

Here’s my code.

Here’s the response that I’m getting on call.

As you can see, my results array is empty. I’m not being able to figure out what’s wrong here? I’m sending same object as mentioned in documentation then why is it not being able to create association?

I also checked in hubspot GUI, and there’s no association present between any of the contacts to any companies.

Any help would be highly appreciated. Thanks.

Hi, @CMetaliya Thanks for the great question. And thanks for the screenshots :raising_hands: It’s always super helpful for our community when they are provided.

Hey, @himanshurauthan @rlopez @miljkovicmisa do you have any insight or next steps for @CMetaliya?

Thank you very much! – Jaycee

@CMetaliya Can you please try using singular instead of plural?

const fromObjectType = "contact";
const toObjectType = "company";

I’ve tried following and seems like it’s working

Now getting this error after passing fromObjectType and toObjectType as you suggested.

Apart from changing Companies to company and Contacts to contact, I’ve not changed anything.

Hi @CMetaliya,
Just had a look at the thread, and you were right to use contacts and companies, using plural as fromObjectType and toObjectType. That is why in the first place you were at least receiving a response from the endpoint (and in the second instance you’re just receiving an error code from the server because the API call is incorrect).
Now, I’m no NodeJS expert, but I’m having a look at the documentation and it looks like you have a syntax problem, you have the “inputs” between quotes whereas you should drop them :

Can you please try to stick with that syntax and see if that solves your problem ?
Don’t hesitate to mark this as a solution to help others facing the same issue !
Best,

Ludwig

Nice work, @LMeert. Thanks for taking the time to respond :raising_hands:

Best – Jaycee

Hey @Jaycee_Lewis,
Thanks, I got a request to have a look at this in my DMs but was in meetings all day :face_with_crossed_out_eyes:
But glad I could help in the end !