Node samples
Basics
Example of uuid:
- Using UUID -> "373bcdd0-c082-4e7b-addd-e10ef813946e";
Methods
getVersionHistory
Description:
Method | Return values | Description |
---|---|---|
getVersionHistory(String uuid) |
List<Version> |
Returns a list of the version history of a document. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<Version> versions = ws.getVersionHistory("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
restoreVersion
Description:
Method | Return values | Description |
---|---|---|
restoreVersion(String uuid, String versionName) |
void |
Restore a document to a specific version. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
ws.restoreVersion("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7","1.0");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
purgeVersionHistory
Description:
Method | Return values | Description |
---|---|---|
purgeVersionHistory(String uuid) |
void |
Purge version history of a document. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
ws.purgeVersionHistory("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
mayBePromotedAsRecord
Description:
Method | Return values | Description |
---|---|---|
mayBePromotedAsRecord(String uuid, bool fullEvaluation) |
PromoteAsRecordEvaluation |
Returns a PromoteAsRecordEvaluation object. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
ws.mayBePromotedAsRecordNode("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7", false);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
promoteAsRecord
Description:
Method | Return values | Description |
---|---|---|
promoteAsRecord(String uuid) |
void |
Promote as record. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
ws.promoteAsRecord("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
isElectronicRecordPath
Description:
Method | Return values | Description |
---|---|---|
isElectronicRecordPath(String uuid) |
Boolean |
Returns true when the node is an electronic record. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
bool isERP = ws.isElectronicRecordPath("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
degradeRecord
Description:
Method | Return values | Description |
---|---|---|
degradeRecord(String uuid) |
void |
Degrade a record. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
ws.degradeRecord("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getElectronicRecordInPath
Description:
Method | Return values | Description |
---|---|---|
getElectronicRecordInPath(String uuid) |
Record |
Get the electronic record in path. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
Record record = ws.getElectronicRecordInPath("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
subscribe
Description:
Method | Return values | Description |
---|---|---|
subscribe(String uuid) |
void |
Adds a subscription to a node. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
ws.subscribe("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
unsubscribe
Description:
Method | Return values | Description |
---|---|---|
unsubscribe(String uuid) |
void |
Delete a subscription to a node. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
ws.unsubscribe("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
importZip
Description:
Method | Return values | Description |
---|---|---|
importZip(String uuid, FileStream content) |
void |
Import a zip file. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
String folderId = "70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7";
FileStream zipFile = new FileStream("D:\\Test.zip", FileMode.Open, FileAccess.Read);
ws.importZip(folderId, zipFile);
zipFile.Close();
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
exportZip
Description:
Method | Return values | Description |
---|---|---|
exportZip(List<String> uuids, bool background) |
Stream |
Export as a zip file. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<string> uuids = new List<string>();
uuids.Add("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7");
uuids.Add("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801");
// Get strem exportZip
Stream s = ws.exportZip(uuids, false);
// Save as zip file
FileStream zipFile = new FileStream("D:\\Testing\\Test.zip", FileMode.OpenOrCreate, FileAccess.ReadWrite);
s.CopyTo(zipFile);
zipFile.Close();
s.Close();
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
unZip
Description:
Method | Return values | Description |
---|---|---|
unZip(String uuid, String dstId) |
void |
Unzip file. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
String zipFileId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801";
String folderId = "70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7";
ws.unZip(zipFileId, folderId);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getNodeByUuid
Description:
Method | Return values | Description |
---|---|---|
getNodeByUuid(String uuid) |
Node |
Get a node by uuid. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
Node node = ws.getNodeByUuid("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801");
System.Console.WriteLine(node.toString());
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getChildrenNodesPaginated
Description:
Method | Return values | Description |
---|---|---|
getChildrenNodesPaginated(String uuid, int offset, int limit, String filter, String orderByField, bool orderAsc, List<int> filteredTypes) |
ChildNodeList |
Get children nodes paginated. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<int> filteredTypes = new List<int>();
filteredTypes.Add(1);
String folderId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801";
ChildNodeList nodeList = ws.getChildrenNodesPaginated(folderId, 0, 10, "", NodesPaginationInfo.ORDER_BY_NAME, true, filteredTypes);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getChildrenNodesByCategoryPaginated
Description:
Method | Return values | Description |
---|---|---|
getChildrenNodesByCategoryPaginated(String uuid, int offset, int limit, String filter, String orderByField, bool orderAsc, List<int> filteredTypes) |
ChildNodeList |
Get children nodes by category paginated. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<int> filteredTypes = new List<int>();
filteredTypes.Add(1);
String folderId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801";
ChildNodeList nodeList = ws.getChildrenNodesByCategoryPaginated(folderId, 0, 10, "", NodesPaginationInfo.ORDER_BY_NAME, true, filteredTypes);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getBreadcrumb
Description:
Method | Return values | Description |
---|---|---|
getBreadcrumb(String uuid) |
List<BreadCrumbItem> |
Get bread crumb. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
String folderId = "82555dd1-bcc2-4e64-81cb-5f7c2b0d7801";
List<BreadCrumbItem> list = ws.getBreadcrumb(folderId);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getNodesFiltered
Description:
Method | Return values | Description |
---|---|---|
getNodesFiltered(List<String> uuids) |
List<Node> |
Return a node list. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<string> uuids = new List<string>();
uuids.Add("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801");
List<Node> nodes = ws.getNodesFiltered(uuids);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
evaluateDownloadZip
Description:
Method | Return values | Description |
---|---|---|
evaluateDownloadZip(List<String> uuids) |
ZipDownloadEvaluationResult |
Return a ZipDownloadEvaluationResult object. |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<string> uuids = new List<string>();
uuids.Add("82555dd1-bcc2-4e64-81cb-5f7c2b0d7801");
ZipDownloadEvaluationResult zdeResult = ws.evaluateDownloadZip(uuids);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
generateDownloadToken
Description:
Method | Return values | Description |
---|---|---|
generateDownloadToken(String uuid, bool preview) |
String |
Generate a node download link. |
When parameter preview is set to true, the token will be generated for previewing purpose. The preview token expires by default in a minute. The user must build the download URL with the returned token:
|
Example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.openkm.sdk4csharp;
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.generateDownloadToken("70ec54af-76ad-4d02-b9c8-8c94c3b6ffc7", true));
} catch (Exception e) {
System.Console.WriteLine(e.ToString());
}
}
}
}
restore
Description:
Method | Return values | Description |
---|---|---|
restore(String uuid) |
Node |
Restore a node |
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:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
Node node = ws.restore("0f6463f3-4d36-4091-b518-4fe7c353ee70");
System.Console.WriteLine(node.toString());
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}