Bookmark samples
Basic
Suggested code sample
First, you must create the web service object:
OKMWebservices ws = OKMWebservicesFactory.newInstance(host);
Then you should log in using the method "login". You can access the "login" method from the web service object "ws" as shown below:
ws.login(user, password);
Once you are logged in with the web service, the session is kept in the web service object. Then you can use the other API methods.
At this point you can use all the Bookmark methods from the "bookmark" class as shown below:
ws.bookmark.getUserBookmarks()
Methods
getUserBookmarks
Description:
Method | Return values | Description |
---|---|---|
getUserBookmarks() |
List<Bookmark> |
Returns a list of all the bookmarks of a user. |
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:8180/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
List<Bookmark> bookmarks = ws.bookmark.getUserBookmarks();
foreach (Bookmark bm in bookmarks)
{
System.Console.WriteLine(bm.toString());
}
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
createBookmark
Description:
Method | Return values | Description |
---|---|---|
createBookmark(String uuid, String name) |
void |
Creates a new bookmark. |
The value of the uuid is the UUID of the node (document, folder, mail, or 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:8180/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
ws.bookmark.createBookmark("a37f570f-5e7f-4a03-8d04-9b3689be82f1", "Any name");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
renameBookmark
Description:
Method | Return values | Description |
---|---|---|
renameBookmark(int bookmarkId, String name) |
void |
Renames a bookmark. |
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:8180/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
int bookmarkId = 1;
ws.bookmark.renameBookmark(bookmarkId, "New name");
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}
deleteBookmark
Description:
Method | Return values | Description |
---|---|---|
deleteBookmark(int bookmarkId) |
void |
Deletes a bookmark. |
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:8180/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservice ws = OKMWebservicesFactory.newInstance(host);
try
{
ws.login(user, password);
int bookmarkId = 1;
ws.bookmark.deleteBookmark(bookmarkId);
}
catch (Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
}
}