These are the slides of my engage 2018 session @ Rotterdam. Learn in many examples about the IBM Connections REST API, what the tricks and pitfalls are and how to avoid common mistakes.
2. About.me
• Co-Founder and CEO of hedersoft
• CNX and Graph API Junkie
• System Architect
• Web Developer
• Speaker @ different events
twitter: schmhen – linkedin: de.linkedin.com/in/schmhen - blog: schmhen.de
4. Agenda
• Different APIs
• Example 1: Activity Stream
• Example 2: Embedded Experience
• Example 3: Forum Entry as Question
• Example 4: Wiki Entry
• Example 5: Blog Entry with Embedded Image
• Example 6: File Upload to Community
• Example 7: Email to Activity
• What to expect and get with Connections Pink
• API Real Life Usage
5. Different APIs
• REST APIs
• Service Provider Interfaces (SPIs)
• Event SPI – Hook into events to work with the event data
• Seedlist SPI – Integrate IBM Connections‘ into your search engine
• Service SPI – Learn about the different services provided by CNX
• User SPI – Obtain information about your IBM CNX Users
• The lc.spi.jar file contains the Server and User SPIs and is stored in
the EAR file in the root installation directory of the following
5#engageug
6. Example 1: Activity Stream
URL:
https://<host>/connect
ions/opensocial/<auth>
/rest/activitystreams/<
user ID>/<group ID>
Compoment Meaning
<auth> (optional) omit on form based authentication, otherwise use:
anonymos, basic, oauth.
<user ID> UserID to post to, @me = current User, alternatively:
CommunityUNID, ProfileID
IMPERSONATION!
<group ID> Group to post to
@self = my posts, @friends = friends posts, @all = all posts, ... .
Only @self supported at the moment, more in the infocenter!
12. Example 3: Forum Entry as Question
URL
https://<host>/forums/atom/topics?forumUuid=xyz
Query Params
forumUuid – The Uuid of the forum to post to
atom+xml (as the rest of the APIs)
13. Example 3: Forum Entry as Question
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<title type="text">I have a question</title>
<content type="html">Do you think SS Rotterdam is an awesome
venue?</content>
<category scheme="http://www.ibm.com/xmlns/prod/sn/type"
term="forum-topic"></category>
<category scheme="http://www.ibm.com/xmlns/prod/sn/flags"
term="question"/>
<category term="question"></category>
<category term=“rotterdam"></category>
<category term="2017"></category>
</entry>
15. Example 4: Wiki Entry
URL
https://<host>/wikis/basic/api/wiki/<wiki-
label>/feed
CDATA HTML content
<content type="text/html"><![CDATA[<?xml version="1.0"
encoding="UTF-8"?><!DOCTYPE html [<!ENTITY amp
"&#38;"><!ENTITY lt "<#60;"><!ENTITY gt
">#62;"><!ENTITY nbsp " "><!ENTITY apos
"'"><!ENTITY quot """>]> <div></div>]]></content>
Attention: Wiki’s do have a very narrow HTML interpretation,
my favorite source of problems
16. Example 4: Wiki Entry
Impersonation API
• Allows to act on behalf of someone else
• Special admin rights needed!
• OnPrem: Websphere config
(trustedExternalApplication)
• Cloud: Mail to IBM, request API activation
Header
X-LConn-RunAs: userid=2368723457
18. Example 5: Blog Entry with Embedded Image
URL
https://<host>/blogs/<blog-id>/api/entries
• Up to 5.0 – Base 64 encoded Image
• Since 5.5 – Upload Image and Link
• Escape HTML content in payload
20. Example 6: File Upload to Community
URL
https://<host>/files/basic/api/communitylibrary/<communi
ty-id>/feed
To add to folder first upload file and then move
https://<host>/files/basic/api/library/<folder-
id>/document/<file-id>/entry
Get nonce first
https://<host>/files/basic/api/nonce
Headers
Content-Type, Content-Length, Slug, X-Update-Nonce
22. Example 7: Email to Activity
URL
https://<host>/activities/service/atom2/activity?acti
vityUuid=xyz
Query Parameter
activityUuid – Id of the activity to add item to
• Escape Content (<div> -> <div>)
• Do not forget namespaces!
25. API Real Life Usage
• Source
• Notes Database (3GB)
• 34 categories, 2906 documents
• 25 categories migrated and 5 synchronized
• Destination
• 30 different communities
• Formatting of RichText, Definition of Tags
• Embedded Images
• -> IBM Connections Wiki and Files
POWERED BY
26. Lessons learned
• Different applications = Non-unique APIs
• Impersonation: X-LConn-RunAs
• Different payloads and pitfalls in different applications
• Standalone App or Community App makes no difference, except
for URL
• Embedded Images as Files (CNX 5.5+)
• Use Postman to test the APIs
• Connections Pink: Coexistence of APIs