I am trying to download multiple files in java with a GET-Request using the REST API of oC, but it seems that I'm doing something wrong. I just use a simple HTTP-Protocol and normal compiled java program. I always get a unauthorized fail Exception, despite I gave my login datas by requesting for files. Do I have to configure specified things or integrate any library for that?
I would appreciate any comments and helps regarding my post.
The Python library was just meant to be a reference. The implementation is fairly easy to read; you can try to follow the code to do something similar in your Java application.
No need to configure a full host for this. You can use the WebDAV API of the instance where your account lives in.
Can you provide the exact error message/logs you're seeing upon authentication. Here's a working file download request implemented with OkHTTP library in Java. To see how the basic auth. header can be formed, refer to this StackOverflow question
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://demo.owncloud.com/remote.php/dav/files/demo/Photos/Paris.jpg")
.get()
.addHeader("authorization", "Basic ZGVtbzpkZW1v")
.build();
Response response = client.newCall(request).execute();