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.
I'd tried fiddling with the header value since I posted this question. Changing the header value to multipart/form-data, and in response I get a ERROR 400 return.
Absolutely. To start, I've added the following print statements.
print(r.text)
print(r.json)
print(r.status_code)
When I run my program, I receive the following error lines.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 400 Bad Request</title>
</head>
<body><h2>HTTP ERROR 400</h2>
<p>Problem accessing /crm/v3/imports. Reason:
<pre> Bad Request</pre></p>
</body>
</html>
<bound method Response.json of <Response [400]>>
400
As you can see, this is an error 400, indicating that the server could not process my request. To assist further, I will include my updates to this point.
Maybe you can assist further in fixing the documentation present on the developers page.
The python example for this api is incomplete, as it never uses any form of requests to submit the data to the server. This is not an issue present with the PHP and Shell Script examples, however, when they both take the files in, they're "important_file.csv", but when the json config line occurs, the file name is different "final_emails.csv" from the file that was read in.
In response to this I receive the following error message.
b'<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>\n<title>Error 400 Bad Request</title>\n</head>\n<body><h2>HTTP ERROR 400</h2>\n<p>Problem accessing /crm/v3/imports. Reason:\n<pre> Bad Request</pre></p>\n</body>\n</html>\n'
400
The test data csv is sitting one directory lower than the python code. I've also tried with having the python code and the testdata.csv file sitting in the same directory. Both resulted in the above 400 Bad request error.
I've been doing a bit more thinking. If this worked on your end, it might be the data formatting. I'll include an image of what my csv of test data looks like.
Could you please give it a go with my test data, and updated code please?
You have been extremely helpful. It looks like it's finally been fixed on my end. Thank you very much! My issues had been the following:
1) When I was making the request, I'd been using the relative path, instead of the absolute path. (Changing to absolute fixed the 400 error)
2) The data portion formatting, they need to be the same as they're listed in that order as the csv file. I'd swapped First Name and website accidentally, and the two were merged on the submission.
3) Any columns that I couldnt map to were not skipped by default (as I'd foolishly assumed), once I had added in