Bookmark samples

Basics

On most methods you'll see parameter named "nodeId". The value of this parameter can be a valid document, folder, mail or record UUID or path.

Example of nodeId:

  • Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db";
  • Using path -> "/okm:root/logo.png"

Methods

getUserBookmarks

Description:

MethodReturn valuesDescription

getUserBookmarks()

List<Bookmark>

Returns a list of all the bookmarks of a user.

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Bookmark;

public class Test {

    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);

        try {
            for (Bookmark bookmark : ws.getUserBookmarks()) {
                System.out.println(bookmark);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

createBookmark

Description:

MethodReturn valuesDescription

createBookmark(String nodeId, String name)

void

Create a new bookmark.

The value of the nodeId is the UUID or PATH of the node ( document, folder, mail or record ).

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Bookmark;

public class Test {

    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);

        try {
            Bookmark bookmark = ws.createBookmark("/okm:root/openkm.png", "test bookmark");
            System.out.println(bookmark);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

renameBookmark

Description:

MethodReturn valuesDescription

renameBookmark(int bookmarkId, String name)

Bookmark

Rename a bookmark

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Bookmark;

public class Test {

    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);

        try {
            int bookmarkId = 1;
            Bookmark bookmark = ws.renameBookmark(bookmarkId, "set bookmark");
            System.out.println(bookmark);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

deleteBookmark

Description:

MethodReturn valuesDescription

deleteBookmark(int bookmarkId)

void

Delete a bookmark.

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {

    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);

        try {
            int bookmarkId = 1;
            ws.deleteBookmark(bookmarkId);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

getBookmark

Description:

MethodReturn valuesDescription

getBookmark(int bookmarkId)

Bookmark

get a bookmark

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Bookmark;

public class Test {

    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);

        try {
            int bookmarkId = 1;
            Bookmark bookmark = ws.getBookmark(bookmarkId);
            System.out.println(bookmark);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}