import requestsimport jsonimport osurl = "http://api.hubapi.com/crm/v3/imports"headers = { 'authorization': 'Bearer %s' % 'pat-na1-NOPE', 'content-type': 'multipart/form-data'}full_path = os.path.abspath("Sample.csv")print(full_path)data = { "name": "November Marketing Event Leads", "files": [ { "fileName": "Sample.csv", "fileFormat": "CSV", "dateFormat": "DAY_MONTH_YEAR", "fileImportPage": { "hasHeader": True, "columnMappings": [ { "columnObjectTypeId": "0-1", "columnName": "first_name", "propertyName": "First Name", "idColumnType": None }, { "columnObjectTypeId": "0-1", "columnName": "last_name", "propertyName": "Last Name", "idColumnType": None }, { "columnObjectTypeId": "0-1", "columnName": "email", "propertyName": "Email", "idColumnType": None } ] } } ]}datastring = json.dumps(data)payload = {"importRequest": datastring}current_dir = os.path.dirname(__file__)# relative_path = "./test_import.csv"files = [ ('files', open(full_path, 'rb'))]print(files)response = requests.request("POST", url, data=payload, files=files, headers=headers)print(response.text.encode('utf8'))print(response.status_code)
Hi, @RKhan282
Thanks for posting. PLEASE PLEASE PLEASE be careful and make sure you remove your Authorization tokens from public posts before hitting the submit button. I edited your post to remove your Private App details. And you should strongly consider rotating your key ASAP.
To your question, are you saying that you’re getting the empty 200 response and Contacts are created? Or that, you’re getting the empty 200 response and Contacts are not created?
Thank you,
Jaycee
I am getting the empty 200 response and Contacts are not created.

