We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Nov 25, 2022 1:08 PM - edited Nov 25, 2022 1:14 PM
I'm in the process of trying to begin integrating HubSpot with an external application from which I am trying to upload CSV formatted data to create an import .
Language: Python
url = "https://api.hubapi.com/crm/v3/imports"
headers = {
'authorization': 'Bearer %s' % ApiKey,
'Content-Type': 'application/json'
}
response = requests.request("POST", url,headers=headers, data=payload, files=files)
the payload is
{
"name": "IMPORT xxx",
"dateFormat": "DAY_MONTH_YEAR",
"files": [
{
"fileName": "import_xxx.csv",
"fileFormat": "CSV",
"fileImportPage": {
"hasHeader": True,
"columnMappings": [
{
"columnObjectTypeId": "0-1",
"columnName": "Chiave",
"propertyName": "chiave",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Nome",
"propertyName": "firstname",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Telefono",
"propertyName": "phone",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Cellulare",
"propertyName": "mobilephone",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Email",
"propertyName": "email",
"idColumnType": "HUBSPOT_ALTERNATE_ID"
},
{
"columnObjectTypeId": "0-1",
"columnName": "Marca",
"propertyName": "marca",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Modello",
"propertyName": "modello",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Versione",
"propertyName": "versione",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Filiale",
"propertyName": "filiale",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Venditore",
"propertyName": "venditore",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Provincia",
"propertyName": "provincia",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Data Contratto",
"propertyName": "data_contratto",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Citta",
"propertyName": "city",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Con Permute",
"propertyName": "con_permute",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Indirizzo",
"propertyName": "address",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Targa",
"propertyName": "targa",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Magic Cliente",
"propertyName": "magic_cliente",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Magic Societa",
"propertyName": "magic_societa",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Data Preventivo",
"propertyName": "data_preventivo",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "Cliente After Sales",
"propertyName": "cliente_after_sales",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "timestamp_ultima_modifica",
"propertyName": "data_ultima_modifica_gino",
"idColumnType": None
},
{
"columnObjectTypeId": "0-1",
"columnName": "duplicate",
"propertyName": "duplicate",
"idColumnType": None
}
]
}
}
]
}
the file is a correct CSV
I update the authorization method of your integration's API requests with doc at: migration
Then error is:
415 Client Error: Unsupported Media Type for url: https://api.hubapi.com/crm/v3/imports
Unfortunately the documentation is not complete....
From this information, can you see any issues in what I am doing? Please let me know if more information is required.
thks
Solved! Go to Solution.
Nov 29, 2022 3:30 PM
Hi, @MCalegher 👋 Can you set your Content-Type header to
multipart/form-data
and try again?
I found it in the documentation, but it was a bit tucked away — “For the request header, add a Content-Type
header with a value of multipart/form-data
.”
Hey, @tominal, am I missing anything obvious here?
Best,
Jaycee
Nov 29, 2022 3:30 PM
Hi, @MCalegher 👋 Can you set your Content-Type header to
multipart/form-data
and try again?
I found it in the documentation, but it was a bit tucked away — “For the request header, add a Content-Type
header with a value of multipart/form-data
.”
Hey, @tominal, am I missing anything obvious here?
Best,
Jaycee
Nov 29, 2022 4:26 PM
Thanks😀
Nov 29, 2022 3:34 PM
I would bet that's it!