/
HistoryTutorial.java
50 lines (43 loc) · 1.64 KB
/
HistoryTutorial.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.io.IOException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class HistoryTutorial {
public static void main( String[] args )
{
/** String representation of the URL to the Authentication-Service of the enaio® system. */
String baseUrl = "";
/** User name of an user with authorization to retrieve audit entries for a specific object. */
String userName = "";
/** User password of an user with authorization to retrieve audit entries for a specific object. */
String userPwd = "";
/** Tenant name of the user with user name {@code userName}. */
String userTenant = "";
OkHttpClient.Builder builder = new OkHttpClient.Builder();
OkHttpClient client = builder.build();
String auth = "Basic " + Base64.getEncoder().encodeToString((userName + ":" + userPwd).getBytes());
String objectId = "";
String historyUrl = baseUrl + "/dms-core/objects/" + objectId + "/history";
Request request = new Request.Builder()
.header("Authorization", auth)
.header("X-ID-TENANT-NAME", userTenant)
.url(historyUrl)
.get()
.build();
try
{
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
}
}