Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

upload file with curl via webhdfs failed with content-type set to 'application/octet-stream' error

upload file with curl via webhdfs failed with content-type set to 'application/octet-stream' error

New Contributor

Hi all

 

I am having touble upload file to hdfs via webhdfs, the followed the example command line in the WebHDFS user guide

 

curl.exe -i -X PUT -L "http://webhdfsserver:14000/webhdfs/v1/user/TRODev/a.txt?op=CREATE&user.name=TRODev -T a.txt

 

the command failed with the following error:

 

HTTP Status 400 - Data upload requests must have content-type set to 'application/octet-stream'


type Status report

message Data upload requests must have content-type set to 'application/octet-stream'

description The request sent by the client was syntactically incorrect.

 

Any idea on what is wrong with the command? How to set the content-type in the curl command line?

 

Please help. Thanks.

 

1 REPLY 1

Re: upload file with curl via webhdfs failed with content-type set to 'application/octet-stream' err

Use the -H flag to provide a content-type

curl -H 'Content-Type: text/xml' -X PUT ...

Regards,
Gautam Gopalakrishnan