I’m working on an integration that requires using Import API. I’m testing it with a small csv file (only contains two lines and around 10 columns) locally. I’ve tested with Postman with the csv file and request body, and the data was imported successfully.
Then I tried to do the same API call in the server, with the following lines:
I’ve confirmed the requestStr is the same as in Postman (in fact, I got the requestStr here first then pasted it in Postman), and the csv file is also the same. However, the request keeps returning a 400 bad request error. Could anyone provide insights here on any potential causes?
Thanks for reaching out to the HubSpot Community!
While looking around the Community, I did find several threads that you might want to check out:
- The solution from @YGhimire on this post “Getting 400 Bad Request”
- The solution from @jjovick on this post “(400) Bad Request”
- The solution from my colleague Jaycee on this post “400 Error on POST to Contacts API”
Also, I’d love to put you in touch with our Top Experts: Hi @Anton, @sylvain_tirreau and @zach_threadint do you have other suggestions to help @SSun7, please?
Have a lovely day and thanks so much in advance for your valuable contributions!
Bérangère
Have you installed the form-data module (npm install form-data) that you are using in your script? When attaching the file, specify the name and type. Try something like that: