Activity samples
Basic
Suggested code sample
First, you must create the webservice object:
OKMWebservices ws = OKMWebservicesFactory.newInstance(host);
Then you should log in using the method "login". You can access the "login" method from the webservice object "ws" as shown below:
ws.login(user, password);
Once you are logged in with the web services, the session is kept in the webservice object. Then you can use the other API methods.
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 logs by date, user, action, and item. |
The value of the item is the UUID of the node (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 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());
}
}
}
}