forked from D-Net/dnet-hadoop
changed from deprecated method to new one
This commit is contained in:
parent
c8f32dd109
commit
4cf4454341
|
@ -60,7 +60,9 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
|
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
|
||||||
|
|
||||||
|
|
||||||
RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, json);
|
//RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, json);
|
||||||
|
|
||||||
|
RequestBody body = RequestBody.create(json, MEDIA_TYPE_JSON);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(urlString)
|
.url(urlString)
|
||||||
|
@ -126,7 +128,8 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
|
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
|
||||||
|
|
||||||
RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, metadata);
|
//RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, metadata);
|
||||||
|
RequestBody body = RequestBody.create(metadata, MEDIA_TYPE_JSON);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(urlString + "/" + deposition_id)
|
.url(urlString + "/" + deposition_id)
|
||||||
|
@ -158,10 +161,13 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
|
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
|
||||||
|
|
||||||
|
RequestBody body = RequestBody.create(json, MEDIA_TYPE_JSON);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(urlString + "/" + deposition_id + "/actions/publish")
|
.url(urlString + "/" + deposition_id + "/actions/publish")
|
||||||
.addHeader("Authorization", "Bearer " + access_token)
|
.addHeader("Authorization", "Bearer " + access_token)
|
||||||
.post(RequestBody.create(MEDIA_TYPE_JSON, json))
|
//.post(RequestBody.create(MEDIA_TYPE_JSON, json))
|
||||||
|
.post(body)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = httpClient.newCall(request).execute()) {
|
try (Response response = httpClient.newCall(request).execute()) {
|
||||||
|
@ -191,10 +197,13 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
|
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
|
||||||
|
|
||||||
|
RequestBody body = RequestBody.create(json, MEDIA_TYPE_JSON);
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(urlString + "/" + deposition_id + "/actions/newversion")
|
.url(urlString + "/" + deposition_id + "/actions/newversion")
|
||||||
.addHeader("Authorization", "Bearer " + access_token)
|
.addHeader("Authorization", "Bearer " + access_token)
|
||||||
.post(RequestBody.create(MEDIA_TYPE_JSON, json))
|
//.post(RequestBody.create(MEDIA_TYPE_JSON, json))
|
||||||
|
.post(body)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = httpClient.newCall(request).execute()) {
|
try (Response response = httpClient.newCall(request).execute()) {
|
||||||
|
|
Loading…
Reference in New Issue