Using the HttpFS Server with curl

You can use a tool such as curl to access HDFS using HttpFS. For example, to obtain the home directory of the user babu, use a command such as this:

$ curl "http://localhost:14000/webhdfs/v1?op=gethomedirectory&user.name=babu"

You should see output such as this:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: hadoop.auth="u=babu&p=babu&t=simple&e=1332977755010&s=JVfT4T785K4jeeLNWXK68rc/0xI="; Version=1; Path=/
Content-Type: application/json
Transfer-Encoding: chunked
Date: Wed, 28 Mar 2012 13:35:55 GMT

{"Path":"\/user\/babu"}

See the WebHDFS REST API web page for complete documentation of the API.