Basic concepts

Authentication

The first lines in your .NET code should be used to create the Webservices object.

We suggest using this method:

OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
using com.openkm.sdk4csharp.exception;

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, username, password);
try { System.Console.WriteLine(ws.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(); } } }

Also is possible doing the same from each API class implementation.

We do not suggest this way.

For example with this method:

RepositoryImpl repositoryImpl = new RepositoryImpl(host, username, password);

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";
            RepositoryImpl repositoryImpl = new RepositoryImpl(host, username, password);
             try { System.Console.WriteLine(repositoryImpl.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/apidoc/ you'll see all available javadoc documentation.

At the moment of writing this page the actual OpenKM version was 6.3.0 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 classDescriptionSupportedImplementationInterface

OKMAuth

Manage security and users. For example adds or removes grants on a node, creates or modifies users or getting the profiles.

Yes

AuthImpl.cs

BaseAuth.cs

OKMBookmark

Manages the user bookmarks.

No

   

OKMDashboard

Manages all data shown at dashboard.

No

   

OKMDocument

Manages documents. For example creates, moves or deletes a document.

Yes

DocumentImpl.cs

BaseDocument.cs

OKMFolder

Manages folders. For example creates, moves or deletes a folder.

Yes

FolderImpl.cs

BaseFolder.cs

OKMMail

Manages mails. For example creates, moves or deletes mails.

No

MailImpl.cs

BaseMail.cs

OKMNote

Manages notes on any node type. For example creates, edits or deletes a note on a document, folder, mail or record.

Yes

NoteImpl.cs

BaseNote.cs

OKMNotification

Manages notifications. For example adds or removes subscriptions on a document or a folder.

No

 

 

OKMProperty

Manages categories and keywords. For example adds or removes keywords on a document, folder, mail or record.

Yes

PropertyImpl.cs

BaseProperty.cs

OKMPropertyGroup

Manage metadata. For example add metadata group, set metadata fields.

Yes

PropertyGroupImpl.cs

BasePropertyGroup.cs

OKMRepository

A lot of stuff related with repository. For example get the properties of main root node ( /okm:root ).

Yes

RepositoryImpl.cs

BaseRepository.cs

OKMSearch

Manages the search feature. For example manages saved queries or perform a new query to the repository.

Yes

SearchImpl.cs

BaseSearch.cs

OKMStats

General stats of the repository.

No

   

OKMUserConfig

Manage user home configuration.

No

   

Class Hierarchy

Packages detail:

NameDescription

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.definition.BaseAuth
  • com.openkm.sdk4csharp.definition.BaseDocument
  • com.openkm.sdk4csharp.definition.BaseFolder
  • com.openkm.sdk4csharp.definition.BaseNote
  • com.openkm.sdk4csharp.definition.BaseProperty
  • com.openkm.sdk4csharp.definition.BasePropertyGroup
  • com.openkm.sdk4csharp.definition.BaseRepository
  • com.openkm.sdk4csharp.definition.BaseSearch

com.openkm.sdk4csharp.impl

All interface implementation classes:

  • com.openkm.sdk4csharp.impl.AuthImpl
  • com.openkm.sdk4csharp.impl.DocumentImpl
  • com.openkm.sdk4csharp.impl.FolderImpl
  • com.openkm.sdk4csharp.impl.NoteImpl
  • com.openkm.sdk4csharp.impl.PropertyGroupImpl
  • com.openkm.sdk4csharp.impl.PropertyImpl
  • com.openkm.sdk4csharp.impl.RepositoryImpl
  • com.openkm.sdk4csharp.impl.SearchImpl

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.