filab - How to programmatically authenticate to HDFS in fiware cosmos -


i'm writing .net application c# programmatically run rest apis against hdfs on fiware on http post operations fails 401 (access denied). works simple operations i'm not sure how authentication. spec seems spegna , delegated auth tokens 2 options how do programmatically? have user name , password go off of. i'm using restsharp library make rest interactions easier.

this code works

var client = new restclient("http://cosmos.lab.fi-ware.org:14000"); request = new restrequest("webhdfs/v1/user/<userid>"); request.addparameter("op", "liststatus"); request.addparameter("user.name", "<userid>"); irestresponse response = client.execute(request); var content = response.content; // raw content string 

this code fails http 401

var client = new restclient("http://cosmos.lab.fi-ware.org:14000"); var request = new restrequest("webhdfs/v1/user/<userid>/structured_data123.txt",method.put); request.addparameter("op", "create"); request.addparameter("user.name", "<userid>"); irestresponse response = client.execute(request); 

http status 401 - org.apache.hadoop.security.authentication.client.authenticationexception: anonymous requests disallowed

thoughts? ideas? thank in advance!

without being expert on restsharp, i've seen addparameter method supports 5 types of parameters (link).

according 5 types, webhdfs request needs parameters of type "querystring" (the parameters must added request uri , not part of request body);

request.addparameter("op", "create", parametertype.querystring); request.addparameter("user.name", "<userid>", parametertype.querystring); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -