You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by Kevin Minder <ke...@hortonworks.com> on 2013/11/23 00:10:30 UTC

Following redirects with curl

Hey Everyone,

I was writing some docs and bemoaning the need to document two curl 
commands for every WebHDFS file operations.  I was complaining to 
myself, "Why can't curl just follow the redirects?"  Then I had one of 
those moments when you realize you're an idiot, of course curl can 
follow redirects.  The two commands below PUT and GET a file via 
Knox/WebHDFS in a single command.  The key is the -L switch.

curl -i -k -u guest:guest-password -L -T README -X PUT 
'https://localhost:8443/gateway/sandbox/webhdfs/v1/user/guest/test/input/README?op=CREATE'
curl -i -k -u guest:guest-password -X GET -L 
'https://localhost:8443/gateway/sandbox/webhdfs/v1/user/guest/test/input/README?op=OPEN'

Enjoy, I know I will!
Kevin.

-- 
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to 
which it is addressed and may contain information that is confidential, 
privileged and exempt from disclosure under applicable law. If the reader 
of this message is not the intended recipient, you are hereby notified that 
any printing, copying, dissemination, distribution, disclosure or 
forwarding of this communication is strictly prohibited. If you have 
received this communication in error, please contact the sender immediately 
and delete it from your system. Thank You.