Community articleWorking with community widgets
Added by IBM contributorIBM on June 23, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.
Tags: commapi

Overview



The Community Widgets feed provides an ATOM interface for working with Widgets in a community programmatically. The services provided are:

Getting a list of widgets in the community: Getting a list of widgets in a community
Adding a widget to a community: Adding a community widget
Updating a widget in a community Updating a community widget
Deleting a widget from a community Deleting a community widget
Retrieving a community widget Retrieving a community widget


Table of widget entry elements


There are a set of common Widget entry elements that are used in these services: returned in the list of widgets in a feed, used to get/set Widget state. These elements are listed in the table below:

All elements are in the http://www.w3.org/2005/Atom namespace, except those that are prefixed with snx: which are in the Connections http://www.ibm.com/xmlns/prod/sn namespace.

Element
How treated on input
Description
<id>
Ignored
ATOM id
<snx:customTitle>
Updates user visible title
If no title is provided, then this element will use a localized default title.
<category term="widget" scheme="http://www.ibm.com/xmlns/prod/sn/type" />
Required
Identifies the entry as a widget Atom entry.
<link href="..." rel="self" />
Ignored
URL to get this Widgets ATOM entry
<link href="..." rel="edit" />
Ignored
URL to use to edit Widget
<link href="..." rel="alternate" />
Ignored
URL that can be used in a Web browser to display the Widget.
<snx:widgetDefId>
Will be required for POSTs, Ignored for PUTs
Indicates the type of widget. Must match the widgetDefId of an enabled widget.
<snx:widgetCategory>
Ignored
Category from Widget Configuration file
<snx:widgetInstanceId>ID</snx:widgetInstanceId>
required for PUT, ignored for POST, DELETE
Widget Instance ID
<snx:hidden>true or false</snx:hidden>
optional default false
Hidden/Visible state
<snx:location>col2 or col3 (or col2statusposts for Status Updates widget only)</snx:location>
required unless snx:hidden is true in which case it's ignored
Column location
<snx:previousWidgetInstanceId>ID or empty if first item in column<snx:previousWidgetInstanceId>
optional. ignored if snx:hidden is true
Position given by previous widget instance id
<snx:widgetProperty key="xxx"> value </snx:widgetProperty
Optional
Provides the widget instance data. There may be multiple instances of this element

Example Widget Entry

A general Widget entry in the atom widget feed looks like this:


<entry xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<id>https://brobertsvm1.swg.usma.ibm.com:9443/communities/service/atom/community/widgets?communityUuid=78214ce7-etc&amp;widgetInstanceId=W85cde7f5a97etc</id>

<title type="text">MyLibrary</title>


<category term="widget" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>


<link href="https://brobertsvm1.swg.usma.ibm.com:9443/communities/service/atom/community/widgets?communityUuid=78214ce7-etc&amp;widgetInstanceId=W85cde7f5a97etc" rel="self"></link>


<link href="https://brobertsvm1.swg.usma.ibm.com:9443/communities/service/html/communityview?communityUuid=78214ce7-etc" rel="alternate"></link>


<snx:widgetDefId>MyLibrary</snx:widgetDefId>

<snx:widgetInstanceId>W85cde7f5a97etc</snx:widgetInstanceId>

<snx:hidden>false</snx:hidden>
<snx:previousWidgetInstanceId><snx:previousWidgetInstanceId>  <!-- No widget instance id =>  this is the first widget in the column -->

<snx:widgetCategory></snx:widgetCategory>

<snx:widgetProperty key="value1">value 11</snx:widgetProperty>  <!-- Widget specific attribute values are here -->
<snx:widgetProperty key="value2">value 22</snx:widgetProperty>

</entry>