0
votes

I am trying to use cURL POST method to make REST API call from my RHEL system. I am using below request:

curl -X POST --header "Content-Type:text/xml;charset=UTF-8" --data @file myurl.com

However, the data is not getting posted into the target site and showing below status:

upload completely sent off: 121 out of 121 bytes < HTTP/1.1 415 Unsupported Media Type < Content-Type: text/html; charset=iso-8859-1 < Date: Wed, 19 Aug 2015 13:55:43 GMT < Content-Length: 0 <

Connection #0 to host ---- left intact

Closing connection #0

P.S. I tried with all possible options like passing user:passwd, / changing Content types...with no success.

2

2 Answers

0
votes

If you are trying to upload a text file you should use this:

curl -X POST --header "Content-Type:text/xml;charset=UTF-8" --form "fileupload:@file.txt" myurl.com

And probably you can also remove the --header

0
votes

Hi I could able to POST the request by maintaining content-type as */* and it solved my problem. Thanks for help