Unsupported Media Type : POSTMAN

Akhilesh1011
Contributor

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.

Akhilesh1011_0-1616491546828.png

Akhilesh1011_1-1616491581709.png

 

Can someone help me in fixing this issue?

 

Thanks,

Akhilesh

 

1 ACCEPTED SOLUTION

Accepted Solutions
kevin.cho
Certified Master Anaplanner

Re: Unsupported Media Type : POSTMAN

Hey @Akhilesh1011 , 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!

View solution in original post

5 REPLIES 5
kevin.cho
Certified Master Anaplanner

Re: Unsupported Media Type : POSTMAN

 @Akhilesh1011 

 

Set the body as "raw" rather than "form-data", and then copy the contents of your file into the body. 

 

example_upload.png

Akhilesh1011
Contributor

Re: Unsupported Media Type : POSTMAN

@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 it
kevin.cho
Certified Master Anaplanner

Re: Unsupported Media Type : POSTMAN

Figured out how to do it in Postman. Set it to "binary" rather than "form-data" and select your file there. 

 

example_binary.png

 

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

 

 

Akhilesh1011
Contributor

Re: Unsupported Media Type : POSTMAN

Thank You @kevin.cho.

Please also let me know if you find a solution in POSTMAN
kevin.cho
Certified Master Anaplanner

Re: Unsupported Media Type : POSTMAN

Hey @Akhilesh1011 , 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!

View solution in original post