Skip to content
Other versions

Loading…

Bookmark samples

First, you must create the web service object:

OKMWebservices ws = OKMWebservicesFactory.getInstance(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);

At this point you can use all the Bookmark methods from the “bookmark” class as shown below:

ws.bookmark.getUserBookmarks()

Description:

Method Return values Description
getUserBookmarks() List Returns a list of all bookmarks for a user.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Bookmark;
import com.openkm.sdk4j.impl.OKMWebservices;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
for (Bookmark bookmark : ws.bookmark.getUserBookmarks()) {
System.out.println(bookmark);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
create(String uuid, String name)
void Create a new bookmark.
  • The value of the uuid is the UUID of the node (document, folder, mail or record).

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.impl.OKMWebservices;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
ws.bookmark.create("a37f570f-5e7f-4a03-8d04-9b3689be82f1", "test bookmark");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
rename(int bookmarkId, String name) void Rename a bookmark.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.impl.OKMWebservices;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
int bookmarkId = 1;
ws.bookmark.rename(bookmarkId, "set bookmark");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
delete(int bookmarkId) void Delete a bookmark.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.impl.OKMWebservices;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
int bookmarkId = 1;
ws.bookmark.delete(bookmarkId);
} catch (Exception e) {
e.printStackTrace();
}
}
}