Search code examples
xpagesibm-sbt

Bookmarks API - getBookmarks(context.getUser().getMail()


I am working with the IBM SBT SDK. For the Get My Bookmarks and Get Popular Bookmarks routines the user will be identified via:

var bkmkSvc = new com.ibm.sbt.services.client.connections.bookmarks.BookmarkService("connections"); 
var bkmks = bkmkSvc.getBookmarks(context.getUser().getMail());

In my case the app resides on on premise Domino and connections I use greenhouse for now.

context.getUser().getMail() returns nothing since I am not authenticated for Domino.

How can I use the userid from connections instead to collect my bookmarks?


Solution

  • You can make a call to ProfileService https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaSnippets.xsp#snippet=Social_Profiles_Get_My_Profile

    ProfileService connProfSvc = new ProfileService();
    Profile profile = connProfSvc.getMyProfile();
    out.println("my UserId "+profile.getUserid()+"<br>");
    

    then you can use the id to make the request to the backend bookmarks.
    getBookmarks(String id) <- uses the id anyway...

    I hope this helps