Sending a csv file using a postman post request


Is it possible to send and store a csv file stored in my computer to an external endpoint using a POST/PUT request in Postman?

I have tried selecting ‘form-data’ in the body, file type as key and selecting the csv file as its value. Additionally, I have selected ‘multipart/form-data’ as the Content-Type under Headers.

When I try this I get the following error;
“message”: “Invalid JSON in body of request”,
“reason”: null

Hey @sandalil !

Yes, it’s possible to send a CSV file from your computer to an endpoint using Postman.

Your approach with form-data is correct. However, the error suggests the server is expecting a JSON payload, not a file. Here’s a quick guide:

  1. Headers: Remove the manual Content-Type header. When using form-data, Postman should set this for you, ensuring the correct boundaries are appended.
  2. Server Expectations: Double-check if the endpoint truly expects a file or if it’s geared towards JSON payloads. It might be helpful to consult the API documentation or the backend team.
  3. Postman Console: It offers a detailed view of the sent request. It might help identify any mismatches.

Let me know if you need more assistance!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.