Bookmark samples
Basics
Suggested code sample
First, you must create the webservice object:
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
Then should login using the method "login". You can access the "login" method from webservice object "ws" as is shown below:
ws.login(user, password);
Once you are logged with the webservices the session is keep in the webservice Object. Then you can use the other API method
At this point you can use all the Bookmark methods from "bookmark" class as is 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:
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();
}
}
}
createBookmark
Description:
Method | Return values | Description |
---|---|---|
createBookmark(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.createBookmark("a37f570f-5e7f-4a03-8d04-9b3689be82f1", "test bookmark");
} catch (Exception e) {
e.printStackTrace();
}
}
}
renameBookmark
Description:
Method | Return values | Description |
---|---|---|
renameBookmark(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.renameBookmark(bookmarkId, "set bookmark");
} catch (Exception e) {
e.printStackTrace();
}
}
}
deleteBookmark
Description:
Method | Return values | Description |
---|---|---|
deleteBookmark(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.deleteBookmark(bookmarkId);
} catch (Exception e) {
e.printStackTrace();
}
}
}