APIs & Integrations

davidalk
Member

Bulk Import Date Format Problem

Hi,

 

I am trying to do a bulk import by sending a POST request to

https://api.hubapi.com/crm/v3/imports

 

 This is working however my dates are failing to map as the import is using the default MMDDYYYY format but I am uploading the dates with YYYYMMDD format. I am specifiying the dates as per this document:

https://developers.hubspot.com/docs/api/crm/imports

 

Here is a sample of my JSON request:

 

{
  "name": "auth0-import",
  "files": [
    {
      "fileName": "auth0-export.csv",
      "fileFormat": "CSV",
      "dateFormat": "YEAR_MONTH_DAY",
      "fileImportPage": {
        "hasHeader": true,
        "columnMappings": [
          {
            "ignored": false,
            "columnName": "First Name",
            "idColumnType": null,
            "propertyName": "firstname",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-1",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Last Name",
            "idColumnType": null,
            "propertyName": "lastname",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-1",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Email Address",
            "idColumnType": "HUBSPOT_ALTERNATE_ID",
            "propertyName": "email",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-1",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Company Domain Name",
            "idColumnType": "HUBSPOT_ALTERNATE_ID",
            "propertyName": "domain",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-2",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Name",
            "idColumnType": null,
            "propertyName": "name",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-2",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Organisation Type",
            "idColumnType": null,
            "propertyName": "organisation_type",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-2",
            "associationIdentifierColumn": false
          }
        ]
      }
    }
  ]
}

 

Is there any reason why the date format isn't working here as expected?

 

Thanks.

0 Upvotes
5 Replies 5
EPosa
Member

Bulk Import Date Format Problem

Hi @davidalk,

You can perform an automated data import using Help Desk Migration and avoid coding. Before the import, the tool allows you to check your existing and new records and map them to prevent mismatches. You can learn more details here: https://help-desk-migration.com/migration-services/

0 Upvotes
VAndersen
Member

Bulk Import Date Format Problem

This might be an old thread, but for people looking for an answer to this question it is possible to add the dateFormat key to the outer most scope. This is what worked for me. It is not shown in the documentation, but I was able to retrieve a list of completed imports and saw that the imports had the dateFormat key in a different place than what I had. I don't know if placing the key within the file object in the files array even does anything?

 

 

 

{
  "name": "auth0-import",
  "dateFormat": "YEAR_MONTH_DAY",
  "files": [
    {
      "fileName": "auth0-export.csv",
      "fileFormat": "CSV",
      "dateFormat": "YEAR_MONTH_DAY",
      "fileImportPage": {
        "hasHeader": true,
        "columnMappings": [
          {
            "ignored": false,
            "columnName": "First Name",
            "idColumnType": null,
            "propertyName": "firstname",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-1",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Last Name",
            "idColumnType": null,
            "propertyName": "lastname",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-1",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Email Address",
            "idColumnType": "HUBSPOT_ALTERNATE_ID",
            "propertyName": "email",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-1",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Company Domain Name",
            "idColumnType": "HUBSPOT_ALTERNATE_ID",
            "propertyName": "domain",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-2",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Name",
            "idColumnType": null,
            "propertyName": "name",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-2",
            "associationIdentifierColumn": false
          },
          {
            "ignored": false,
            "columnName": "Organisation Type",
            "idColumnType": null,
            "propertyName": "organisation_type",
            "foreignKeyType": null,
            "columnObjectTypeId": "0-2",
            "associationIdentifierColumn": false
          }
        ]
      }
    }
  ]
}

 

 

 

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Bulk Import Date Format Problem

Hi @davidalk ,

Any luck? 

@prosa , @tominal  anything look out of place here?

0 Upvotes
davidalk
Member

Bulk Import Date Format Problem

Hi Dennis,

 

I can get it to work by changing the dates in my source csv file to use mm/dd/yyyy but thats not ideal. Would be good to know if there is a way to get it working with other formats.

 

Thanks.

0 Upvotes
tominal
Guide | Partner
Guide | Partner

Bulk Import Date Format Problem

I haven't used this endpoint in any integration just yet, but isn't there supposed to be a date property somewhere in that columnMappings array to map the date over?

I could be wrong here because I haven't practiced with it.


Thomas Johnson
Community Champion


Kahu Software LLC
A Texan HubSpot consulting firm
https://kahusoftware.com