I was writing some code to gracefully handle a 409 Conflict when sending a batch create contact request. I originally assumed that “at least one” of the contacts in the batch must be conflicted and that if I parsed the error response, I could determine the email address causing the conflict, “remove” that item from the batch and retry the request. In this way I could “clean up” the request until it worked. What I found was that, in a batch of more than one contact where at least one was a conflict, but others were not, the “non-conflicted” item(s) DOES get created, even though the request itself returns a 409.
This led to the issue of not knowing WHICH contacts got created and which did not get created. Is there a reason that that the batch create could not return a 207 Multi-status?
This link implies that a batch update SHOULD return a 207 if only partially successful but that does not seem to apply to a 409. In fact, the behavior of that endpoint differs in that the ENTIRE request fails if there is a conflict.
So, in summary:
Batch-creating multiple contacts “partially” succeeds even when one of the contacts encounters a conflict - but returns an error.
Batch-updating multiple contacts “entirely fails” when there is one single conflict.
My struggle with the way it works now is that an error is returned, but the the request may have “worked” all except for one item. In a normal situation I would have some kind of successful response that could be logged, etc. In this case I have a 409 response and the hope that “most of” of the contacts got created.
Hi guys! I’m trying to use HubSpot batch API and have the next problem: when I send 3 contacts to https://api.hubapi.com/crm/v3/objects/contact/batch/create and if one of these contacts has a problem - HubSpot response format is like this:
{ "status": "error", "message": "Property values were not valid: ......." "correlationId": "2c2b03e3-5692-4261-b462-0bea1952e562", "category": "VALIDATION_ERROR"}
Hi, is there any update on this issue? We would like to use batch API because we have many contacts to update and we are hitting rate limits.
However, batch update/create does not return errors for individual entities, so we are forced to first try to create an entity then get error about already existing one and use ID to update it.
We would like to send batch create request, get list of already existing IDs and then perform batch update, so that we send less requests to Hubspot API.
I barely found this top because it sounds like a recommendation, not a problem. But I think that the problem is the same as mine.
When trying to update a pack of objects, if there are conflicts in one of the objects, HubSpot gives 409 instead of the expected 207.
Our integration service with HubSpot collects changes to objects and once in N time makes a batch request. And now, we see a lot of duplicate errors, because, at error 409, the service does not understand which objects HubSpot was able to update and which are not.
Example request:
Status: 409 Conflict
{
"status": "error",
"message": "A contact with the email 'alexander_2@gmail.com' already exists.. Existing ID: 551",
"correlationId": "f41edb07-25bf-4340-af3c-3313d09d16f6",
"category": "CONFLICT"
}
To avoid synchronization problems, I had to disable batch requests, but this will increase the number of requests to the HubSpot API and affect the limits.
I’ve just encountered this issue now and it’s disheatening to find a thread from Nov 2020 with no clear solution. Seems like this should definitely be a 207 response!
I feel a bit caught out as I’ve coded a solution using this API and now suddenly find myself feeling like the batch endpoints aren’t fit for purpose which are the main endpoints I need!
Weird how the error message I recieved has even less information in it than what @aastashov posted.
To get the email to be able to identify the offending record I need to parse the error message to get the HubSpot ID and then use that to fetch the contact details with another API request…
I’ve noticed this issue is not just limited to conflicts either. I’m having the same thing happen for validation errors that are returning 400 responses. Yep, I’m going to have to do the same as aastashov and disable batch requests. They’re unsuable in their current state.
@zaklein , there was an issue created on that repo for this, but I was informed that there is no timeline on the fix. They split up a product group so one owns the contacts object so hopefully sooner than later
Any updates here? Attempting to batch update and create contacts, and the error messages are very unhelpful to determine which contact objects have been created successfully or unsuccessfully
How does this not have an answer yet? It was asked in 2020 originally and it’s 2023 and I am running into the same issue without being able to find an answer?