Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
There’s an API for that! Why and 
how to build on the IBM 
Connections PLATFORM 
Mikkel Flindt Heisterberg 
Senior Solutio...
Agenda 
• Brief intro to 
–IBM Connections as a PLATFORM 
–iWidgets for IBM Connections 
–Developing for the Activity Stre...
The IBM Connections platform
Widgets
Widgets – descriptor 
<iw:iwidget id="com.example.ExampleWidget" supportedModes="view fullpage” 
mode="view” lang="en" xml...
Widgets – iScope 
dojo.provide("com.example.ExampleWidget"); 
dojo.declare("com.example.ExampleWidget", null, { 
construct...
Widgets – declaration 
Declaratively configured using widgets-config.xml 
<widgetDef defId="com.example.ExampleWidget” 
ur...
Widgets – iContext 
• An iContext instance is set into the iScope instance 
• The iContext provides access to the widget m...
Loading prior to IBM Connections 
5
Loading from IBM Connections 5
Loading from IBM Connections 5 
http://www.youtube.com/ 
watch?v=1GLpA604Iic
Activity Stream 
• The following is based on my highly acclaimed 
(cough, cough) presentation on the Activity 
Stream 
• M...
Activity Stream 
• IS 
– River of news – it’s like water flowing by you 
– Notifications about ”stuff” happening in (other...
Activity Stream 
• In my opinion it makes most sense to not consider 
the activity stream as one single stream 
• Instead ...
Activity Stream 
• You will mainly use the POST and PUT methods to send JSON data (Content-Type: 
application/json) to the...
Activity Stream 
{ 
"actor": {"id": "@me"}, 
"verb": "post", 
"title": "Some entry title", 
"updated": "2013-05-17T12:00:0...
Activity Stream 
https://<host>/connections/opensocial/<auth>/rest/activitystreams 
/<user ID>/<group ID>/<application ID>...
Activity Stream 
1. /activitystreams/@me/@all 
List my (current users) entries 
2. /activitystreams/@public/@all 
List pub...
Other Programming Interfaces 
• SPIs are lower-level programming interfaces which may be subject to 
modification from rel...
Event Handlers – declaration 
Declaratively configured using events-config.xml 
<postHandler enabled=”true" invoke="ASYNC"...
Event Handlers – implementation 
import com.ibm.connections.spi.events.EventHandler 
public class MyEventHandler implement...
Event Handlers – summary 
• Make event handlers asynchroneous 
• What happens if your event handler fail? 
• What happens ...
Thank you 
• Presentations on slideshare.net – this one is 
coming 
• Contact me – often times more than willing to 
help ...
There’s an API for that! Why and how to build on the IBM Connections PLATFORM
Upcoming SlideShare
Loading in …5
×

There’s an API for that! Why and how to build on the IBM Connections PLATFORM

2,354 views

Published on

"There’s an API for that! Why and how to build on the IBM Connections PLATFORM" from Social Connections VII in Stockholm, Sweden 13-14 November 2014.

Published in: Technology
  • Be the first to comment

There’s an API for that! Why and how to build on the IBM Connections PLATFORM

  1. 1. There’s an API for that! Why and how to build on the IBM Connections PLATFORM Mikkel Flindt Heisterberg Senior Solution Architect and Partner OnTime® by IntraVision
  2. 2. Agenda • Brief intro to –IBM Connections as a PLATFORM –iWidgets for IBM Connections –Developing for the Activity Stream –SPI’s and Event handlers Mikkel Flindt Heisterberg Twitter: @lekkim E-mail: mfh@intravision.dk http://lekkimworld.com http://slideshare.net/lekkim
  3. 3. The IBM Connections platform
  4. 4. Widgets
  5. 5. Widgets – descriptor <iw:iwidget id="com.example.ExampleWidget" supportedModes="view fullpage” mode="view” lang="en" xmlns:iw="http://www.ibm.com/xmlns/prod/iWidget" iScope="com.example.ExampleWidget"> <iw:resource uri="http://www.example.com/ExampleWidget.js" /> <iw:resource uri="http://www.example.com/ExampleWidget.css" /> <iw:content mode="view"> <![CDATA[ <div id="_IWID_widgetContent">Loading...</div> ]]> </iw:content> <iw:content mode="fullpage"> <![CDATA[ <div id="_IWID_widgetContent">Loading...</div> ]]> </iw:content> </iw:iwidget>
  6. 6. Widgets – iScope dojo.provide("com.example.ExampleWidget"); dojo.declare("com.example.ExampleWidget", null, { constructor: function() {}, onLoad: function() {}, onView: function() {}, onEdit: function() {}, onFullpage: function() {}, onSearch: function() {} });
  7. 7. Widgets – declaration Declaratively configured using widgets-config.xml <widgetDef defId="com.example.ExampleWidget” url="/ExampleWidget.xml" loginRequired="true” showInPallette=”true” primaryWidget=”false”> <itemSet> <item name="resourceId" value="{resourceId}" /> <item name="profilesCtx" value="{profilesSvcRef}" /> <item name="myProp" value="Abc123" /> </itemSet> </widgetDef>
  8. 8. Widgets – iContext • An iContext instance is set into the iScope instance • The iContext provides access to the widget markup (e.g. root element), I/O related functions (i.e. URL rewriting), widget attributes etc. • The iContext is easily accessed from the iScope class using this.iContext • Important functions include: – iContext.getRootElement() : DOM Element – iContext.getElementById(id:string) : DOM Element – iContext.getiWidgetAttributes() : ItemSet – iContext.getUserProfile() : ItemSet – iContext.io.rewriteURI(uri:string) : string – iContext.iEvents.fireEvent(name:string, type:string, payload:object)
  9. 9. Loading prior to IBM Connections 5
  10. 10. Loading from IBM Connections 5
  11. 11. Loading from IBM Connections 5 http://www.youtube.com/ watch?v=1GLpA604Iic
  12. 12. Activity Stream • The following is based on my highly acclaimed (cough, cough) presentation on the Activity Stream • Much more detail and many examples there • See http://slideshare.net/lekkim Mikkel Flindt Heisterberg Twitter: @lekkim E-mail: mfh@intravision.dk http://lekkimworld.com http://slideshare.net/lekkim
  13. 13. Activity Stream • IS – River of news – it’s like water flowing by you – Notifications about ”stuff” happening in (other) systems – we refer to these notifications as entries • ISN’T – A new inbox – doesn’t replace email – A perpeptual data store – entries are deleted based on a server defined purge interval (default is 30 days) unless saved or actionable
  14. 14. Activity Stream • In my opinion it makes most sense to not consider the activity stream as one single stream • Instead think that – Each user has his/her own (@me) – There is a public stream (@public) – A community may have a stream if the widget has been added by a community owner – if there’s no stream for a community posting to it will return a ”403 Forbidden”
  15. 15. Activity Stream • You will mainly use the POST and PUT methods to send JSON data (Content-Type: application/json) to the API • JSON is super simple key/value data format. It has simple datatypes (strings, numbers, booleans), objects and arrays { ”email”: ”mh@intravision.dk”, ”niceGuy”: true, ”age”: 37, ”name”: { ”first”: ”Mikkel Flindt”, ”last”: ” Heisterberg” }, ”Connectospheres”: [6, 7, 8, 9, 10, 11, 12, 13, 14, 15] }
  16. 16. Activity Stream { "actor": {"id": "@me"}, "verb": "post", "title": "Some entry title", "updated": "2013-05-17T12:00:00.000Z", "object": { "title": "Some object title", "objectType": "note", "id": "1234567890-1234567890-1234567890" } }
  17. 17. Activity Stream https://<host>/connections/opensocial/<auth>/rest/activitystreams /<user ID>/<group ID>/<application ID>/<activity ID> Component Meaning <auth> (optional) If using form based authentication leave this component out. Otherwise options are anonymos, basic, oauth. <user ID> The user whose stream you’re addressing – use @me for current users stream, @public for public stream or a community ID for the stream in a community. <group ID> The group of entries you’re addressing – use @all for all posts or options for special meaning such as @saved, @actions, @mentions. Refer for InfoCenter and resources slide for more. <application ID> When retrieving entries this refers to the application (or ”generator”) that created the entry. All the IBM Connections app names can be used (profiles, blogs, wikis etc.) plus custom ones (e.g. ontimegc). @all used for all applications. <activity ID> Used to reference a specific event e.g. for updating saved status.
  18. 18. Activity Stream 1. /activitystreams/@me/@all List my (current users) entries 2. /activitystreams/@public/@all List public stream entries 3. /activitystreams/@me/@actions List my actionable events 4. /activitystreams/@me/@saved/blogs List my saved events from blogs 5. /@me/@all/@all/urn:lsid:lconn.ibm.com:activitystreams.story:bdb562f… Work with entry from my stream based on ID * All URLs above start with https://<host>/connections/opensocial/<auth>/rest Also used when creating new entries (e.g. POSTing)
  19. 19. Other Programming Interfaces • SPIs are lower-level programming interfaces which may be subject to modification from release to release. • Event SPI – The IBM Connections Event SPI allows third parties to consume event data generated by IBM Connections. • Seedlist SPI – Use the Seedlist service provider interface (SPI) provided with IBM Connections to integrate your search engine with IBM Connections content. • Service SPI – You can use the IBM Connections Service SPI to learn about the applications running in your IBM Connections deployment. • User SPI – You can use the IBM Connections User SPIs to access information about the users in your IBM Connections deployment.
  20. 20. Event Handlers – declaration Declaratively configured using events-config.xml <postHandler enabled=”true" invoke="ASYNC" name=”MyEventHandler” class="com.example.MyEventHandler"> <subscriptions> <subscription source="*" type="*" eventName="*"/> <!-- <subscription source=”PROFILES" type="*" eventName=”profiles.updated"/> <subscription source=”PROFILES" type="*" eventName=”profiles.person.photo.updated"/> --> </subscriptions> </postHandler>
  21. 21. Event Handlers – implementation import com.ibm.connections.spi.events.EventHandler public class MyEventHandler implements EventHandler { public void init() throws EventHandlerInitException {} public void destroy() {} public void handleEvent(Event event) throws EventHandlerException { String eventName = event.getName(); // event name Person actor = event.getActor(); // person that triggered event // look at the event name if (event.getName().equals("profiles.person.photo.updated")) { // a profile photo was updated this.doEventProfilesPhotoUpdated(event); } else if (event.getName().equals("profiles.updated")) { // a profile was updated this.doEventProfilesUpdated(event); } } }
  22. 22. Event Handlers – summary • Make event handlers asynchroneous • What happens if your event handler fail? • What happens if the recipient of the event (3rd party API) fail? • Be defensive – consider what happens if events are lost
  23. 23. Thank you • Presentations on slideshare.net – this one is coming • Contact me – often times more than willing to help – I’ll let you know when it’s a project  Mikkel Flindt Heisterberg Twitter: @lekkim E-mail: mfh@intravision.dk http://lekkimworld.com http://slideshare.net/lekkim

×