Record samples
On most methods, you'll see the parameter named "recId" and "fldId". The value of these parameters can be a valid record and folder UUID.
Example of recId:
- Using UUID -> "28bb0c8b-3701-4457-a81a-fef7bc56ff33"
Methods
createRecord
Description:
Method | Return values | Description |
---|---|---|
createRecord(String fldId, String name, String title, long nodeClass) |
Record |
Creates a new record and returns as a result an object Record. |
Optionally it can be set a title variable, the other variables of the Record ( record ) will not take any effect on record creation. |
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.createRecord(fldId, "PKI-100200", "some title", 0);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getRecordProperties
Description:
Method | Return values | Description |
---|---|---|
getRecordProperties(String recId) |
Record |
Returns the record properties. |
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.getRecordProperties("50b7a5b9-89d2-430e-bbc9-6a6e01662a71").path);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
deleteRecord
Description:
Method | Return values | Description |
---|---|---|
deleteRecord(String recId) |
void |
Deletes a record. |
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);
ws.deleteRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
purgeRecord
Description:
Method | Return values | Description |
---|---|---|
purgeRecord(String recId) |
void |
Records are definitely removed from the repository. |
Usually, you will purge records into /okm:trash/userId - the personal trash user locations - but is possible to directly purge any record from the whole repository. When a record is purged it will only be able to be restored from a previous repository backup. The purge action removes the record definitely from the repository. |
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);
ws.purgeRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
renameRecord
Description:
Method | Return values | Description |
---|---|---|
renameRecord(String recId, String newName) |
void |
Renames a record. |
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);
ws.renameRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71", "PKI-100201");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
moveRecord
Description:
Method | Return values | Description |
---|---|---|
moveRecord(String recId, String dstId) |
void |
Moves a record into a folder or record. |
The values of the dstId parameter should be a folder or record UUID or path. |
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);
ws.moveRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71", "055e4384-7c70-4456-b32b-f5a55a79861f");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
copyRecord
Description:
Method | Return values | Description |
---|---|---|
copyRecord(String recId, String dstId, String newName) |
Record |
Copies a record into a folder or record. |
The values of the dstId parameter should be a folder or record UUID or path. When parameter newName value is null, the record will preserve the same name. Only the security grants are copied to the destination, the metadata, keywords, etc. of the record are not copied. |
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);
ws.copyRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71", "055e4384-7c70-4456-b32b-f5a55a79861f", "PKI-100200");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
isValidRecord
Description:
Method | Return values | Description |
---|---|---|
isValidRecord(String recId) |
Boolean |
Returns a boolean that indicates if the node is a record or not. |
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("Is a record:"+ ws.isValidRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71").ToString());
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getRecordChildren
Description:
Method | Return values | Description |
---|---|---|
getRecordChildren(String fldId) |
List<Record> |
Returns a list of all records which their parent is fldId |
The parameter fldId can be a folder or a record 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);
foreach (Record rec in ws.getRecordChildren("055e4384-7c70-4456-b32b-f5a55a79861f"))
{
System.Console.WriteLine(rec);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
lockRecord
Description:
Method | Return values | Description |
---|---|---|
lockRecord(String recId) |
LockInfo |
Locks a record and returns an object with the Lock information |
Only the user who locked the record is allowed to unlock. A locked record cannot be modified by other users. |
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);
LockInfo linf = ws.lockRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
unlockRecord
Description:
Method | Return values | Description |
---|---|---|
unlockRecord(String recId) |
void |
Unlocks a locked record. |
Only the user who locked the document is allowed to unlock. |
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);
ws.unlockRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
forceUnlockRecord
Description:
Method | Return values | Description |
---|---|---|
forceUnlockRecord(String recId) |
void |
Unlocks a locked record. |
This method allows unlocking any locked record. It is not mandatory to execute this action by the same user who previously executed the checkout lock action. This action can only be done by a superuser ( user with ROLE_ADMIN ). |
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);
ws.forceUnlockRecord("50b7a5b9-89d2-430e-bbc9-6a6e01662a71");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
setRecordTitle
Description:
Method | Return values | Description |
---|---|---|
setRecordTitle(String recId, String title) |
void |
Sets a record title. |
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);
ws.setRecordTitle("50b7a5b9-89d2-430e-bbc9-6a6e01662a71", "some title");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getRecordPath
Description:
Method | Return values | Description |
---|---|---|
getRecordPath(String uuid) |
String |
Converts a record UUID to record path. |
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.getRecordPath("50b7a5b9-89d2-430e-bbc9-6a6e01662a71"));
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
setRecordNodeClass
Description:
Method | Return values | Description |
---|---|---|
setRecordNodeClass(String recId, long ncId) |
void |
Sets a record node class. |
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);
ws.setRecordNodeClass("50b7a5b9-89d2-430e-bbc9-6a6e01662a71", 0);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
setRecordDispositionStage
Description:
Method | Return values | Description |
---|---|---|
setRecordDispositionStage(String recId, long stage) |
void |
Set the disposition stage. |
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);
ws.setRecordDispositionStage("50b7a5b9-89d2-430e-bbc9-6a6e01662a71", 1);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
setRecordDescription
Description:
Method | Return values | Description |
---|---|---|
setRecordDescription(String recId, String description) |
void |
Set the title. |
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);
ws.setRecordDescription("50b7a5b9-89d2-430e-bbc9-6a6e01662a71", "some description");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
createWizardRecord
Description:
Method | Return values | Description |
---|---|---|
createWizardRecord(String uuid, String name, String title, long nodeClass) |
WizardNode |
Create a record with wizard. |
The WizardNode contains a list of pending actions what should be done to complete the process of record creation. These might be:
|
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);
WizardNode wnode = ws.createWizardRecord("f123a950-0329-4d62-8328-0ff500fd42db", "REC-001", "Any title", 0);
System.Console.WriteLine(wnode.toString());
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}