I am testing the Imports API for use in an integration. The integration needs to create and update Contacts and Companies as well as custom objects (and the associations between those recods) from a single .csv file. Everything works as I expect when the import is run manually/through the regular UI in HubSpot. But when I attempt the exact same steps with the Imports API, I am seeing different behavior and errors.
My test is broken into two steps:
Step 1: Run an import with a single row of data representing multiple associated objects. The row contains a contact record and two custom objects (Policy and Party). This is the entire .csv file:
email, policy_id, party_id
dave@fakemail.com, 123, 456
Step 2: Run another import with a second single row of data that is identical to the first, except that the email address for the contact is different:
email, policy_id, party_id
erik@fakemail.com, 123, 456
The expected outcome is that the Policy with ID 123 will be updated to have a new associated contact (erik@fakemail.com) instead of dave@fakemail.com, and the same should happen for the Party with ID 456. This is exactly what happens when I run two subsequent Imports through the regular Import UI/feature of HubSpot.
When I attempt this through the Imports API, however, I get an error on the second import attempt, and nothing gets updated (the Policy and Party objects do not get assigned a new associated contact). The error says "Duplicate Unique Property Value".
Is there some additional field/flag I need to add in my importRequest object that gets sent when initiating the import via the API?
Hey, @khouseman👋 Can you share an example of what your request body looks like? What I am specifically curious about is:
by custom object, do you mean — a custom Contact property? Or a Custom Object? These terms can get switched around, and I want to make sure I fully understand
under column mappings, which property in your request body has a value set for idColumnType?
For example, if email address is used for your unique identifier, it might look like this: