Sending a csv file using a postman post request

Hi,

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.