· 8 years ago · Dec 28, 2017, 05:26 AM
1private const string AppendUrl = "https://{0}.azuredatalakestore.net/webhdfs/v1/{1}?&op=APPEND&noredirect=true";
2
3private const string AppendUrl = "https://{datalakeName}.azuredatalakestore.net/webhdfs/v1/{filepath}?append=true&op=APPEND&api-version=2016-11-01"
4var token = "eyJ0eX.....";
5using (var client = new HttpClient())
6{
7 client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
8 var result = client.GetAsync(url).Result;
9 var data = result.Content.ReadAsStringAsync().Result;
10}
11
12var applicationId = "application Id";
13var secretKey = "secretKey";
14var tenantId = "tenant id";
15var adlsAccountName = "datalake account name";
16var creds = ApplicationTokenProvider.LoginSilentAsync(tenantId, applicationId, secretKey).Result;
17var adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(creds,clientTimeoutInMinutes:60);
18var stream = File.OpenRead(@"C:tomtesttext.txt");
19var test = adlsFileSystemClient.FileSystem.AppendWithHttpMessagesAsync(adlsAccountName, "test/abc.txt", stream).Result;