Note samples
Basics
On most methods, you'll see the parameter named "nodeId". The value of this parameter can be a valid document, folder, mail or record UUID.
Example of nodeId:
- Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db"
Methods
addNote
Description:
Method | Return values | Description |
---|---|---|
addNote(String nodeId, String text) |
Note |
Adds a note to a node and returns an object Note. |
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.addNote("f123a950-0329-4d62-8328-0ff500fd42db", "the note text");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getNote
Description:
Method | Return values | Description |
---|---|---|
getNote(String noteId) |
Note |
Retrieves the note. |
The noteId is a UUID. The object Node has a variable named path, in that case, the path contains a 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);
List<Note> notes = ws.listNotes("f123a950-0329-4d62-8328-0ff500fd42db");
if (notes.Count > 0)
{
System.Console.WriteLine(ws.getNote(notes[0].path));
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
deleteNote
Description:
Method | Return values | Description |
---|---|---|
deleteNote(String noteId) |
Note |
Deletes a note. |
The noteId is an UUID. The object Node has a variable named path, in that case, the path contains a 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);
List<Note> notes = ws.listNotes("f123a950-0329-4d62-8328-0ff500fd42db");
if (notes.Count > 0)
{
ws.deleteNote(notes[0].path);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
setNote
Description:
Method | Return values | Description |
---|---|---|
setNote(String noteId, String text) |
void |
Changes the note text. |
The noteId is a UUID. The object Node has a variable named path, in that case, the path contains a 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);
List<Note> notes = ws.listNotes("f123a950-0329-4d62-8328-0ff500fd42db");
if (notes.Count > 0)
{
ws.setNote(notes[0].path, "text modified");
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
listNotes
Description:
Method | Return values | Description |
---|---|---|
listNotes(String nodeId) |
List<Note> |
Retrieves a list of all notes of 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);
List<Note> notes = ws.listNotes("f123a950-0329-4d62-8328-0ff500fd42db");
foreach (Note note in notes)
{
System.Console.WriteLine(note);
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
getNotesHistory
Description:
Method | Return values | Description |
---|---|---|
getNotesHistory(String nodeId) |
List<NoteHistory> |
Retrieves a list of all notes of 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);
List<NoteHistory> notes = ws.getNotesHistory("f123a950-0329-4d62-8328-0ff500fd42db");
foreach (NoteHistory note in notes)
{
System.Console.WriteLine(note);
}
}
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. |
Parameter preview means that we are generating a token to preview and the token expires in a minute. |
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);
System.Console.WriteLine(ws.generateDownloadToken("f123a950-0329-4d62-8328-0ff500fd42db", true));
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}