Error returned upon deal creation via API, but record created


#1

Deal-Upload über API

Hi,
we are just bulk uploading historic and current deals from a legacy-system to Hubspot.
In general, the errors returned from the various API are very clear and helpful, but wit the deal I encounter a strange problem: For some deals, I get an error returned, not including a dealId that loos like this:

"{"status":"error","message":"internal error","correlationId":"879255a0-6234-43f1-bd5d-852f934c6d01","requestId":"c4f6093fbcc4fc82ea77421aaf41a528"}"

Tells me about nothing. The really ugly point is that in HubSpot, the deal is created nevertheless and I have no reference to it.
I did find the cause for this, it goes like that when I try to upload invalid association references, but the behavior is not as I would expect. Especially that a deal IS created but no indication of this or reference returned is very annoying.

Someone having input on this?


#2

Hi @lucian,

Can you give me some more details on the endpoint you're using and the request you're making? Is it the 'Create a deal' endpoint (POST /deals/v1/deal)? What is the error status code? Can you give me an example request body you used? Do you have a link to an example deal in HubSpot that I can take a look at?


#3

Hi Derek,

you picked the correct endpoint (POST /deals/v1/deal)
With status code you supposedly mean the HTTP status code - the IDE I'm using currently doesn't deliver this to me (a major drawback in other situations also). The JSON-object is exactly as I posted it (the numbers do vary).
As I am working with customer data I can*t give you a link to a deal in Hubspot, but I will try to retrieve a request body for you (anonymous enough...)
...
bad luck. After knowing what caused the error (and in desperate need to get the upload done) I avoided the situation with empty or wrong references, so no error messages are still stored in the project...
But you can test it easily enough by sending arbitrary numbers as references in the associations part of the JSON-object and will see that
a; the error is as described (not specific, no dealId returned)
and
b: the deal is created nevertheless...

Best regards, Lucian


#4

Hi @lucian,

That's tricky; it's tough to dig into an issue without a specific example. Can you direct message me the information I mentioned above, so that it's not being posted on the public forum?

I've tried testing this in my portal by including invalid values in the associations arrays, but I haven't been able to reproduce the error you're describing. Instead, I'm seeing the following:

"associationCreateFailures": [
  {
    "association": {
    "fromObjectId": 326121537,
    "toObjectId": 12436478678,
    "associationCategory": "HUBSPOT_DEFINED",
    "associationTypeId": 3,
    "timestamp": null
  },
  "failReason": "INVALID_OBJECT_IDS",
  "message": "CONTACT=12436478678 is not valid"
}