Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

IBM Connections REST API Klompendans

192 Aufrufe

Veröffentlicht am

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.

Veröffentlicht in: Daten & Analysen
  • Als Erste(r) kommentieren

IBM Connections REST API Klompendans

  1. 1. IBM Connections REST-API Klompendans Henning Schmidt hedersoft GmbH @schmhen 1#engageug
  2. 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
  3. 3. About.hedersoft
  4. 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. 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. 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!
  7. 7. Example 1: Activity Stream { "actor": { "id": "@me" }, "verb": "post", "title": “Presenting the REST-API Klompendans", "content": "This event is my <b>first entry</b>", "object": { "summary": "First Entry details", "objectType": "note", "id": "objectid", "displayName": "First entry“ } } [entry.title] [entry.content] [entry.object.summary] Henning Schmidt posted [entry.object.displayame] [entry.content] [entry.object.summary]
  8. 8. DEMO 8#engageug
  9. 9. Example 2: Embedded Experience
  10. 10. Example 2: Embedded Experience { "actor": {"id": "@me"}, "verb": "post", "content": "This event is my <b>Embedded Experience!</b>", "object": { "summary": "Have a look at hedersoft:", ... }, "openSocial": { "embed": { "gadget": "https://apps.na.collabserv.com/connections/resources/web/com.ibm.social.ee.cloud/cloudee.xml", "context": { "url":"https://www.hedersoft.de", "height": "400" } } }}
  11. 11. DEMO 11#engageug
  12. 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. 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>
  14. 14. DEMO 14#engageug
  15. 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. 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
  17. 17. DEMO 17#engageug
  18. 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
  19. 19. DEMO 19#engageug
  20. 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
  21. 21. DEMO 21#engageug
  22. 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> -> &lt;div&gt;) • Do not forget namespaces!
  23. 23. DEMO 23#engageug
  24. 24. What to expect and get with Connections Pink
  25. 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. 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
  27. 27. THANK YOU!

×