APIs & Integrations

JZhao
Participant

Create a batch of association doesn't seem to work

SOLVE

I'd like to create a batch of associations between contact and one of my customised object.  It returns 204 status code but doesn't create any associations. I have tried to set an invalid id but got 204 success response. It seems this API doesn't work at all.

 

Below is the API I am using:

/crm/v3/associations/{fromObjectType}/{toObjectType}/batch/create
 
Below is the request.
 
body:
{
"inputs": [
{
"from": {
"id": "283651"
},
"to": {
"id": "95047818"
},
"type": "site_to_contact"
},
{
"from": {
"id": "283651"
},
"to": {
"id": "95184723"
},
"type": "site_to_contact"
},
{
"from": {
"id": "283651"
},
"to": {
"id": "95172230"
},
"type": "site_to_contact"
}
]
}
0 Upvotes
1 Accepted solution
lynton
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Create a batch of association doesn't seem to work

SOLVE

If you're successful creating a single association with site, then I would conclude there's a bug in the bulk associations api for custom objects. I'm not sure what else might be causing this. I'm sorry, I'm all out of ideas.

View solution in original post

5 Replies 5
alewolf
Contributor | Partner
Contributor | Partner

Create a batch of association doesn't seem to work

SOLVE

I've run into the same issue with associations from engagements to companies. If I set the batch size to 90 or 100 I get 204 responses, but either one or none of the associations are created. When I use a small batch size of 1 then it works.

 

It is definitely a bug in the API, but difficult to tell what it is. Maybe it has to do with the size of the request. 

 

Also important to note: I am using v1 of the API, while the creator of this thread has been using v3. Both don't work properly.

 

Could some HubSpot employee look into this? Maybe @WendyGoh ?

0 Upvotes
lynton
Contributor | Elite Partner
Contributor | Elite Partner

Create a batch of association doesn't seem to work

SOLVE

Is "site" a custom object? You might need to use the object definition ID instead.

 

My sugestion is to create an association in the UI, and then query that association with the Get Association endpoint. Then you should see an example of an existing association to replicate in the API. I think the issue is with your syntax "site_to_contact" as I haven't seen this before.

JZhao
Participant

Create a batch of association doesn't seem to work

SOLVE

yes site is a customer object. Where do I find defintion id for "site"? And it is success to run the API to create a single association between objects with "site". Why do I need to use a different id for batch API? 

0 Upvotes
lynton
Solution
Contributor | Elite Partner
Contributor | Elite Partner

Create a batch of association doesn't seem to work

SOLVE

If you're successful creating a single association with site, then I would conclude there's a bug in the bulk associations api for custom objects. I'm not sure what else might be causing this. I'm sorry, I'm all out of ideas.

dennisedson
HubSpot Product Team
HubSpot Product Team

Create a batch of association doesn't seem to work

SOLVE

Hey @JZhao , are you still working on this?

@lynton , does anything look out of place here to you?

0 Upvotes