0

In my current project, a user logged in to our third-party tool writes a message, which will then be posted to a community blog in IBM Connections via its REST API.

To be able to write a blog entry, said user has to be a member of that (public) community. On the Connections UI, the user can just click on "join this community", but does the IBM SBT (or even the rest API itself) contain this functionality as well?

As I saw, there are requests to add members to the community, but they can only be made as the community owner (which I dont know in the given context). The API documentation also mentions creating "requests to join" which is also not really feasible in this situation.

Is there any way to achieve what I'm trying to do?

EDIT: I just looked at the request that the UI "join this community" Button sends to the connections server. It sadly is not part of the REST API.

BennyLau
  • 107
  • 8

1 Answers1

0

You should reference the Community Service https://github.com/OpenNTF/SocialSDK/blob/master/sdk/com.ibm.sbt.core/src/main/java/com/ibm/sbt/services/client/connections/communities/Community.java

This Method...

public boolean addMember(Member member) throws CommunityServiceException
    {
return getService().addMember(getCommunityUuid(), member);
    }

Examples are here. https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaScriptSnippets.xsp#snippet=Social_Communities_API_AddMember

These snippets should resolve your issues.

You can use this API...

You can get the Raw XML and process http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Creating_a_request_to_join_a_community_ic45&content=pdcontent

or https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaSnippets.xsp#snippet=Social_Communities_Create_Invite

Paul Bastide
  • 1,505
  • 4
  • 17
  • 22
  • That's the one I referenced in my question, it can only be called by an owner of a community. The JAVADOC of com.ibm.sbt.services.client.connections.communities.CommunityService.addMember(String, Member) even mentions this, now that I'm taking another look. – BennyLau Feb 24 '14 at 15:23
  • Sorry, I just dont understand how to use this API. A community atom entry contains no "http://www.ibm.com/xmlns/prod/sn/requests-to-join" link element for me (even as the owner it does not). It does however contain an "http://www.ibm.com/xmlns/prod/sn/invitations-list" link element. But the documentation tells me to send a "request to join atom entry" without really telling me how such an entry looks like. The SBT command also doesnt seem to fit, since it sends an invite; what I need is the currently authenticated user to just join the community. – BennyLau Feb 25 '14 at 09:51
  • Okay, the "request-to-join" link is only present for moderated communities. So this still does not solve my problem. I just want to join a simple public community :-) – BennyLau Feb 25 '14 at 10:11
  • back to my original point...All you need to is add a member to a public community... POST Method to http://sbtdev.swg.usma.ibm.com:81/communities/service/atom/community/members?communityUuid=1b5d0b59-b9bd-429a-afa2-11ab88205e95 with body... lsuarez@renovations.com this is all done in the toolkit method addMember – Paul Bastide Feb 25 '14 at 13:47
  • but what about the "only owners of the community can call this"?, i tried the call with the sbt method and it did not work (like i expected after reading the javadoc). I will try using the native API, but I don't see why this would work, when only owners are allowed to add members. – BennyLau Feb 25 '14 at 16:29
  • You can call as any user. I did that call as lsuarez when wasadmin owned the community I used. – Paul Bastide Feb 25 '14 at 17:25
  • Thanks Paul! I now tried it with a newly created community and was also able add myself. I dont know, why it didnt work in the first place. Also the javadoc comment in the SBT should maybe be adjusted - restriction to owners may only apply to moderated/private communities for what it's worth... – BennyLau Feb 27 '14 at 12:50