I’m currently not receiving any data back at all while trying to use the CRM api.
I’ve created a python script based on the documentation provided (Accounts Dashboard | HubSpot), but I’m not having any luck.
According to the documentation, it should be able to take in a CSV or Excel Spreadsheet based on the fileFormat value. I’ve tried both and didn’t get a response back from either.
When I checked the endpoints tab to find an example of it being used, there is unfortunately not one provided.
The purpose of this script was to automate the input of excel/csv files that contain contact data for our group. It pulls the provided csv file in this case and submits a post request. I’ve verified that all the column names are correct, as well as their associated propertyNames. The file it’s fetching it in the current directory, it has the correct matching data.
import requests
import json
post_url = 'http://api.hubapi.com/crm/v3/imports?hapikey=c76....901'
latest_file = "thisIsTestData.csv"
headers = {'accept': 'application/json'}
data = {
"name": "import_contacts",
"files": [
{
"fileName": latest_file,
"fileFormat": "CSV",
"fileImportPage": {
"hasHeader": True,
"columnMappings": [
{
"ignored": False,
"columnName": "FirstName",
"idColumnType": None,
"propertName": "firstname",
"foreignKeyType": None,
"columnObjectType": "CONTACT",
"associationIdentifiedColumn": False
},
{
"ignored": False,
"columnName": "Web Site URL",
"idColumnType": None,
"propertyName": "website",
"foreignKeyType": None,
"columnObjectType": "CONTACT",
"associationIdentifiedColumn": False
},
{
"ignored": False,
"columnName": "Ad_Age",
"idColumnType": None,
"propertyName": "ad_age",
"foreignKeyType": None,
"columnObjectType": "CONTACT",
"associationIdentifiedColumn": False
},
{
"ignored": False,
"columnName": "City",
"idColumnType": None,
"propertyName": "city",
"foreignKeyType": None,
"columnObjectType": "CONTACT",
"associationIdentifiedColumn": False
},
{
"ignored": False,
"columnName": "Mobile Phone Number",
"idColumnType": None,
"propertyName": "mobilephone",
"foreignKeyType": None,
"columnObjectType": "CONTACT",
"associationIdentifiedColumn": False
},
]
}
}
]
}
r = requests.post(url=post_url, data=data, headers=headers)
print(r.text)
Is there something I’m missing here? Any help would be appreciated on this.

