Basic concepts
Authentication
First, you must create the webservice object:
OKMWebservices ws = OKMWebservicesFactory.newInstance(host);
Then should login using the method "login". You can access the "login" method from webservice object "ws" as is shown below:
ws.login(user, password);
Once you are logged with the webservices the session is keep in the webservice Object. Then you can use the other API method
At this point you can use all the Repository methods from "repository" class as is shown below:
ws.repository.getAppVersion();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.exception;
using com.openkm.sdk4csharp.impl;
namespace OKMRest
{
public class Program
{
static void Main(string[] args)
{
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try {
ws.login(user, password);
System.Console.WriteLine(ws.repository.getAppVersion().getVersion());
} catch (RepositoryException e) {
System.Console.WriteLine(e.ToString());
} catch (DatabaseException e) {
System.Console.WriteLine(e.ToString());
} catch (UnknowException e) {
System.Console.WriteLine(e.ToString());
} catch (WebserviceException e) {
System.Console.WriteLine(e.ToString());
}
System.Console.ReadKey();
}
}
}
Accessing API
OpenKM API classes are under com.openkm package, as can shown at this javadoc API summary.
At main url http://docs.openkm.com/javadoc/ you'll see all available javadoc documentation.
At the moment of writing this page, the actual OpenKM version was 7.1.5 what can change on time.
There is a direct correspondence between the classes and methods into, implemented at com.openkm.api packages and available from SDK for .NET.
OpenKM API classes:
OpenKM API class | Description | Supported | Implementation | Interface |
---|---|---|---|---|
OKMActivity |
Manages the activity log. |
Yes |
ActivityImpl.cs |
BaseActivity.cs |
OKMAuth |
Manages security and users. For example, add or remove grants on a node, create or modify users or getting the profiles. |
Yes |
AuthImpl.cs |
BaseAuth.cs |
OKMBookmark |
Manages the user bookmarks. |
Yes |
BookmarkImpl.cs |
BaseBookmark.cs |
OKMDashboard |
Manages all data shown at dashboard. |
Yes |
DashboardImpl.cs |
BaseDashboard.cs |
OKMDocument |
Manages documents. For example create, move or delete a document. |
Yes |
DocumentImpl.cs |
BaseDocument.cs |
OKMFolder |
Manages folders. For example create, move or delete a folder. |
Yes |
FolderImpl.cs |
BaseFolder.cs |
OKMMail |
Manages mails. For example create, move or delete a mails. |
Yes |
MailImpl.cs |
BaseMail.cs |
OKMNode |
Manages general purpose node actions. |
Yes |
NodeImpl.cs |
BaseNode.cs |
OKMNote |
Manages notes on any node type. For example create, edit or delete a note on a document, folder, mail or record. |
Yes |
NoteImpl.cs |
BaseNote.cs |
OKMNotification |
Manages notifications. For example add or remove subscriptions on a document or a folder. |
Yes |
NotificationImpl.cs |
BaseNotification.cs |
OKMProperty |
Manages categories and keywords. For example add or remove keywords on a document, folder, mail or record. |
Yes |
PropertyImpl.cs |
BaseProperty.cs |
OKMPropertyGroup |
Manages metadata. For example add metadata group, set metadata fields. |
Yes |
PropertyGroupImpl.cs |
BasePropertyGroup.cs |
OKMRecord |
Manages records. For example create, move or delete a record. |
Yes |
RecordImpl.cs |
BaseRecord.cs |
OKMRelation |
Manages relations between nodes. For example create a relation ( parent-child ) between two documents. |
Yes |
RelationImpl.cs |
BaseRelation.cs |
OKMRepository |
A lot of material related with repository. For example get the properties of main root node ( /okm:root ). |
Yes |
RepositoryImpl.cs |
BaseRepository.cs |
OKMReport |
Manages reports. For example execute reports. |
Yes |
ReportImpl.cs |
BaseReport.cs |
OKMSearch |
Manages search feature. For example manage saved queries or perform a new query to the repository. |
Yes |
SearchImpl.cs |
BaseSearch.cs |
OKMStamp |
Manages stamp. |
Yes |
StampImpl.cs |
BaseStamp.cs |
OKMStats |
General stats of the repository. |
No |
||
OKMTask |
Manages task. For example create a new task. |
Yes |
TaskImpl.cs |
BaseTask.cs |
OKMUserConfig |
Manages user home configuration. |
No |
UserConfigImpl.cs |
BaseUserConfig.cs |
OKMWorkflow |
Manages workflows. For example execute a new workflow. |
Yes |
WorkflowImpl.cs |
BaseWorkflow.cs |
(*) Indicate that exist REST support for it, but still not implemented into the SDK.
|
Class Hierarchy
Packages detail:
Name | Description |
---|---|
com.openkm.sdk4csharp |
The com.openkm.OKMWebservicesFactory that returns an com.openkm.OKMWebservices object which implements all interfaces. OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password); |
com.openkm.sdk4csharp.bean |
Contains all classes result of unmarshalling REST objects. |
com.openkm.sdk4csharp.definition |
All interface classes:
|
com.openkm.sdk4csharp.impl |
All interface implementation classes:
|
com.openkm.sdk4csharp.util |
A couple of utilities. The class com.openkm.sdk4csharp.util.ISO8601 should be used to set and parse metadata date fields. |
com.openkm.sdk4csharp.exception |
All exception classes. |