IBM Connections: Create external Users / Community using rest API

IBM Connections: Create external Users / Community using rest API

Hi all,

this week we had a discussion whether it is possible to create external Users and external Communities using IBM Connections rest API. If you take a look at the documentation of IBM Connections 5 API it seems not…

Anyway even though I`m not a developer I found the missing information how to create external content in IBM Connections 5. This instruction will also show you how to manually create a user or community using a simple Rest client (e.g. as a plugin in Firefox).
The cool thing about the rest client stuff is that you can use it together with SDI (Klaus Bild wrote an excellent article about this –> LINK).

So you do not need to be a hardcore developer with a full-blown Eclipse client anymore to do such magic things πŸ˜‰

Create an external user using rest API:

1) Download and install the RESTClient Firefox addon:

RestClient

2) Change the Method to “POST” and enter the profiles API URL: https://server.domain.com/profiles/admin/atom/profiles.do

Rest Client

3) Now you have to create a xml file and enter the user details:

<!-- Example: Adds Amy Jones 560 to the Profiles application!-->
<entry
xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<id>ignored</id>
<category term="profile" scheme="http://www.ibm.com/xmlns/prod/sn/type" />
<content type="application/xml">
<person xmlns="http://ns.opensocial.org/2008/opensocial">
<com.ibm.snx_profiles.attrib>

<entry>
<key>com.ibm.snx_profiles.base.email</key>
<value>
<type>text</type>
<data>julius.schwarzweller@test.com</data>
</value>
</entry>

<entry>
<key>com.ibm.snx_profiles.base.uid</key>
<value>
<type>text</type>
<data>jschwarzweller</data>
</value>
</entry>
<entry>
<key>com.ibm.snx_profiles.base.givenNames</key>
<value>
<type>text</type>
<data>Julius</data>
</value>
</entry>

<entry>
<key>com.ibm.snx_profiles.base.surname</key>
<value>
<type>text</type>
<data>Schwarzweller</data>
</value>
</entry>

<entry>
<key>com.ibm.snx_profiles.base.displayName</key>
<value>
<type>text</type>
<data>Julius Schwarzweller</data>
</value>
</entry>

<entry>
<key>com.ibm.snx_profiles.base.distinguishedName</key>
<value>
<type>text</type>
<data>cn=julius.schwarzweller,cn=users,ou=de,ou=test</data>
</value>
</entry>

<entry>
<key>com.ibm.snx_profiles.base.guid</key>
<value>
<type>text</type>
<data>1bb4b671-1015-4aaf-8790-4aa31a5f6702</data>
</value>
</entry>

<entry>
<key>com.ibm.snx_profiles.base.userMode</key>
<value>
<type>text</type>
<data>external</data>
</value>
</entry>

<entry>
<key>com.ibm.snx_profiles.sys.usrState</key>
<value>
<type>text</type>
<data>active</data>
</value>
</entry>
</com.ibm.snx_profiles.attrib>
</person>
</content>
</entry>

Well what is missing in the API documentation is the section:

<entry>
<key>com.ibm.snx_profiles.base.userMode</key>
<value>
<type>text</type>
<data>external</data>
</value>
</entry>

Here you can control wether the user is an internal oder external user (Not documented in the API documentation!!!)

4) Insert the content of this xml file into the Rest Client:

A popup will occur where the system asks you to enter the credentials of an administrative user!

Rest Client 3

You will get an “200 OK” if everything worked πŸ˜‰

5) Et voila… The user is created! Cool. You only have to take care that the user is present in the LDAP. Otherwise it might be inactivated (depends on your config).

Create an external Community using rest API:

1) Change the Method to “POST” and enter the communities API URL: https://server.domain.com/communities/service/atom/communities/my

2) Create a xml file and enter the Community details

<?xml version="1.0" encoding="UTF-8"?>

<entry
xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<id>ignored</id>

<title type="text">External Test Community</title>

<summary type="text">ignored</summary>
<content type="html">Information about external Community</content>
<published>ignored</published>

<author>
<name>Julius Schwarzweller</name>
<email>julius.schwarzweller@test.com</email>
<snx:userid>50730340-0101-102e-88e1-f78755f7e0ed</snx:userid>
<snx:userState>active</snx:userState>
</author>

<updated>ignored</updated>

<contributor>
<name>Peter Pan</name>
<email>peter.pan@test.com</email>
<snx:userid>70735340-0131-132e-88e1-f78785f7e7ed</snx:userid>
<snx:userState>active</snx:userState>
</contributor>

<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<snx:membercount>ignored</snx:membercount>
<snx:communityType>private</snx:communityType>
<snx:isExternal>true</snx:isExternal>
</entry>

The important flag to set here (which is not documented):

<snx:isExternal>true</snx:isExternal>

3) You will get the following return “201” if everything worked

Rest Client 4

4) And here we go we created a new external Community πŸ˜‰

Rest client 5

You can extend those rest API calls with hundreds of other commands! I really think this is a cool way to manipulate data and or create new IBM Connections content without being a hard-core developer!

I will continue playing with the API if I find the time to do so πŸ˜‰

I`m happy about comments and tricks about this topic.

Leave a Reply

Your email address will not be published. Required fields are marked *