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
}
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:
Headers: Remove the manual Content-Type header. When using form-data, Postman should set this for you, ensuring the correct boundaries are appended.
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.
Postman Console: It offers a detailed view of the sent request. It might help identify any mismatches.