Aug 3, 2022 10:36 PM
Hello!
I have a question on the import API.
I want to import using `POST /crm/crm/v3/imports` with CONTACT and DEAL associations.
And I want to do this by importing multiple files.
The common column is `email`.
But I get the following error.
Is there anything missing in the JSON?
Is it possible to associate objects in multiple files using the API?
CSV
JSON
{
"name": "Import-contact-records-app",
"files": [
{
"fileName": "contact_test.csv",
"fileFormat": "CSV",
"dateFormat": "YEAR_MONTH_DAY",
"fileImportPage": {
"hasHeader": true,
"columnMappings": [
{
"ignored": false,
"columnObjectTypeId": "0-1",
"columnName": "lastname",
"propertyName": "lastname",
"idColumnType": null
},
{
"ignored": false,
"columnObjectTypeId": "0-1",
"columnName": "email",
"propertyName": "email",
"idColumnType": "HUBSPOT_ALTERNATE_ID",
"associationIdentifiedColumn": true
},
{
"ignored": false,
"columnObjectTypeId": "0-1",
"columnName": "phone",
"propertyName": "phone",
"idColumnType": null
}
]
}
},
{
"fileName": "deal_test.csv",
"fileFormat": "CSV",
"dateFormat": "YEAR_MONTH_DAY",
"fileImportPage": {
"hasHeader": true,
"columnMappings": [
{
"ignored": false,
"columnObjectTypeId": "0-3",
"columnName": "payment_day",
"propertyName": "payment_day",
"idColumnType": null
},
{
"ignored": false,
"columnObjectTypeId": "0-3",
"columnName": "dealname",
"propertyName": "dealname",
"idColumnType": null
},
{
"ignored": false,
"columnObjectTypeId": "0-3",
"columnName": "pipeline",
"propertyName": "pipeline",
"idColumnType": null
},
{
"ignored": false,
"columnObjectTypeId": "0-3",
"columnName": "dealstage",
"propertyName": "dealstage",
"idColumnType": null
},
{
"ignored": false,
"columnObjectTypeId": "0-3",
"columnName": "email",
"propertyName": null,
"idColumnType": null,
"foreignKeyType": {
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 4
},
"associationIdentifiedColumn": false
}
]
}
}
]
}
ERROR MESSAGE
{
"status": "error",
"message": "column objectType ObjectTypeId{legacyObjectType=DEAL} does not match association fromObjectType AssociationDefinition{category=HUBSPOT_DEFINED, id=4, inverseId=3, fromObjectTypeId=ObjectTypeId{legacyObjectType=CONTACT}, toObjectTypeId=ObjectTypeId{legacyObjectType=DEAL}, cardinality=ONE_TO_MANY, inverseCardinality=ONE_TO_MANY, name=CONTACT_TO_DEAL, inverseName=DEAL_TO_CONTACT, hasAllAssociatedObjects=true, isPrimary=false, isInversePrimary=false, inverseHasAllAssociatedObjects=true, maxToObjectIds=10000, maxFromObjectIds=1000, hasCascadingDeletes=false}",
"correlationId": "3abbcce4-76ab-4eed-adbc-2b3f0c8f0833"
}
POSTMAN
Aug 31, 2022 6:40 AM
Hello @Jaycee_Lewis and @Otaka,
So @Otaka I think your JSON needs to be updated by mentioning the idColumnType as HUBSPOT_ALTERNATE_ID and columnObjectTypeId as '0-1' as it's the email of the contact.
So the updated email column of the deal file will look like this -
{"ignored": false,"columnObjectTypeId": "0-1","columnName": "email","propertyName": null,"idColumnType": 'HUBSPOT_ALTERNATE_ID',"foreignKeyType": {"associationCategory": "HUBSPOT_DEFINED","associationTypeId": 4},"associationIdentifiedColumn": false}
Regards,
Aug 4, 2022 4:02 PM
Hi, @Otaka 👋 Thanks for reaching out. Hey, @tjoyce @himanshurauthan @DanielSanchez @Levi do you have any insight you can share with @Otaka?
Best,
Jaycee