PUT with an empty body using httr (on R) to webHDFS PUT with an empty body using httr (on R) to webHDFS curl curl

PUT with an empty body using httr (on R) to webHDFS


Good work, including the curl output. I believe that answers it.

Your curl command uses PUT, and your httr command uses POST. Try https://www.rdocumentation.org/packages/httr/versions/1.4.1/topics/PUT .

Hint for future reference: POST commands are not typically used if you're specifying an exact location. That's what PUT is for.


httr is attempting to follow the redirect, and failing. To fix the issue, tell httr to stop following the location config(followlocation = 0L).

The PUT command will be as follows:

r <- PUT("https://hadoopmgr1p.global.ad:14000/webhdfs/v1/user/testuser/temp/          loadfile_testuser_2019-11-28_15_28_41411?op=CREATE&permission=755&user.name=testuser",           authenticate(":", "", type = "gssnegotiate"),          body=NULL,          config(followlocation = 0L),          verbose())

This should return a valid reponse with a Location header.