Additional information in response on contact/batch

batch

#1

Hi!
I use http://developers.hubspot.com/docs/methods/contacts/batch_create_or_update for integration.
I have a few suggestions for improvement.

At the first, i would like to get a list of VIDs on success. Now i get empty response body.
For example, it can be so:
{
“status”: “success”,
“contacts”: [
{
“email”: %email_of_the_first_item%
“vid”: %vid_of_the_first_item%
},
{
“email”: %email_of_second_item%
“vid”: %vid_of_second_item%
},
{
“email”: %email_of_the_third_item%
“vid”: %vid_of_the third_item%
}
],
“requestId”: “bbb407c1-1da1-4be0-b2b9-44a9e7ae00af”
}

At second, i would like to get error codes on fail of request. It helps automatic handling of errors.
For example, it can be so:
{
“status”: “error”,
“message”: “Errors found processing batch update”,
“correlationId”: “c3128f30-2543-41cc-9e39-0fd384367bce”,
“invalidEmails”: [
“asdas@sdfsdf.test”,
“test-0912.01@test.test”
],
“failureMessages”: [
{
“index”: 40,
“error”: {
“status”: “error”,
“code”: %numeric_code_of_the_error%,
“message”: “You need to supply a vid or email for the contact.”
}
},
{
“index”: 173,
“error”: {
“status”: “error”,
“code”: %numeric_code_of_the_error%,
“message”: “Email address test_2@test.test is invalid”
}
},
{
“index”: 174,
“error”: {
“status”: “error”,
“code”: %numeric_code_of_the_error%,
“message”: “Email address test_1@test.test is invalid”
}
}
],
“requestId”: “bbb407c1-1da1-4be0-b2b9-44a9e7ae00af”
}


#2

Hi @Aeliot-Tm

Updates made through the batch endpoint are processed asynchronously, so while we do validate the email addresses and the property options included in the batch, the actual vids of the updated records aren’t determined before the endpoint generates the response.

Could you tell me more about how’d you’d want to handle errors with numeric codes? Most of the errors you’d get would require some type of update to the record, so having the human readable message in there makes it easier to determine what would need to be changed.