Unsupported Media Type : POSTMAN
Hi,
I am trying to upload a ".csv" file into Anaplan using Postman. Below is the API used.
PUT https://api.anaplan.com/2/0/workspaces/((workspace_id}}/models/{{model_id}}/files/{{file_id}}
But it is throwing an error of "Unsupported Media Type". Below images(also uploaded) are the configurations used.
Can someone help me in fixing this issue?
Thanks,
Akhilesh
Best Answer
-
Hey @Akhilesh9025 , I did and updated my reply.
Select the "binary" option and select your file there.
Remember to mark the problem as solved so other people also can find the answer!
0
Answers
-
Set the body as "raw" rather than "form-data", and then copy the contents of your file into the body.
0 -
@kevin.cho
I am able to run it using "raw" but wanted to test how the API works for uploading a file so that later I can use CURL commands to automate it0 -
Figured out how to do it in Postman. Set it to "binary" rather than "form-data" and select your file there.
The cURL command for this is:
--data-b "@<path_to_file>"
e.g
--data-b "@/mypath/myfilename"
I've confirmed this works - copy out the cURL code you get from Postman for your "raw" type, and then replace the --data-raw component with the snip above.
See this StackOverflow post for more info: post - How to send file contents as body entity using cURL - Stack Overflow
0 -
0