Activity samples
Basic
Suggested code sample
First, you must create the web service object:
OKMWebservices ws = OKMWebservicesFactory.newInstance(host);
Then should login using the method "login". You can access the "login" method from web service object "ws" as is shown below:
ws.login(user, password);
Once you are logged with the web services the session is kept in the web service Object. Then you can use the other API method
At this point, you can use all the Activity methods from the "activity" class as shown below:
ActivityList results = ws.activity.findActivityLog(0, 20, beginDate, endDate, user, "", item);
Methods
findActivityLog
Description:
Method | Return values | Description |
---|---|---|
findActivityLog(int page, int length, DateTime beginDate, DateTime endDate, String user, String action, String item) |
ActivityList |
Returns a list of all activity log by date, user, action and item. |
The item's value is the node's UUID ( document, folder, mail, or record ). |
Example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
using com.openkm.sdk4csharp.impl;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8180/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
DateTime beginDate = new DateTime(2019, 7, 1);
DateTime endDate = new DateTime(2019, 8, 1);
ActivityList activityList = ws.activity.findActivityLog(0, 10, beginDate, endDate, "testUser", "LOGIN", null);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getActivityActions
Description:
Method | Return values | Description |
---|---|---|
getActivityActions() |
List<String> |
Returns a list of all the activity log actions. |
Example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.bean;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8180/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<string> actions = ws.activity.getActivityActions();
foreach(string action in actions)
{
System.Console.WriteLine(action);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}