This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Subscriptions in Yammer



Overview

The following operations allow you to work with subscriptions. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with subscriptions, see Sample configuration

OperationDescription

addSubscription

Adds a new subscription.

deleteSubscriptionDeletes an existing subscription.
getSubThreadRetrieves the thread subscribed to.
getSubTopicRetrieves the topic subscribed to.
getSubUserRetrieves the user.

Operation details

This section provides further details on the operations related to subscriptions.

Adding a subscription

The addSubscription operation adds a new subscription.

addSubscription
<yammer.addSubscription>
    <targetType>{$ctx:targetType}</targetType>
	<targetId>{$ctx:targetId}</targetId>
</yammer.addSubscription>
Properties
  • targetType: The target type to which the user will subscribe or unsubscribe.
  • targetId: The ID of the object to which the user will subscribe or unsubscribe.
Sample request

Following is a sample REST/JSON request that can be handled by the addSubscription operation.

Sample Request for addSubscription
{
	"apiUrl":"https://www.yammer.com",	
	"apiToken":"bwGBT89WMbAwefDZHVaZA",
	"responseType":"json",
	"targetType":"topic",
	"targetId":"6399334"
}
Related Yammer documentation
https://developer.yammer.com/restapi/#rest-subscriptions

Deleting an existing subscription

The deleteSubscription operation deletes an existing subscription.

deleteSubscription
<yammer.deleteSubscription>
    <targetType>{$ctx:targetType}</targetType>
	<targetId>{$ctx:targetId}</targetId>
</yammer.deleteSubscription>
Properties
  • targetType: The target type to which the user will subscribe or unsubscribe.
  • targetId: The ID of the object to which the user will subscribe or unsubscribe.
Sample request

Following is a sample REST/JSON request that can be handled by the deleteSubscription operation.

Sample Request for deleteSubscription
{
	"apiUrl":"https://www.yammer.com",
	"apiToken":"xDH2yacFLuo1yfjTYsoHA",
	"responseType":"json",
	"targetType":"user",
	"targetId":"1530177481"
}
Related Yammer documentation
https://developer.yammer.com/restapi/#rest-subscriptions

Retrieving the thread subscribed to

The getSubThread operation retrieves the thread that has been subscribed to.

getSubThread
<yammer.getSubThread>
	<threadId>{$ctx:threadId}</threadId>
</yammer.getSubThread>
Properties
  • threadId: The ID of a thread.
Sample request

Following is a sample REST/JSON request that can be handled by the getSubThread operation.

Sample Request for getSubThread
{
	"apiUrl":"https://www.yammer.com",
	"apiToken":"uewmZGcC18LOvwYfCRSbPA",
	"responseType":"json",
	"threadId":"1530177481"
}
Related Yammer documentation
https://developer.yammer.com/restapi/#rest-subscriptions

Retrieving the topic subscribed to

The getSubTopic operation retrieves the topic that has been subscribed to.

getSubTopic
<yammer.getSubTopic>
	<topicId>{$ctx:topicId}</topicId>
</yammer.getSubTopic>
Properties
  • topicId: The ID of the topic.
Sample request

Following is a sample REST/JSON request that can be handled by the getSubTopic operation.

Sample Request for getSubTopic
{
	"apiUrl":"https://www.yammer.com",
	"apiToken":"bwGBT89WMbAwefDZHVaZA",
	"responseType":"json",
	"topicId":"6399334"
}
Related Yammer documentation
https://developer.yammer.com/restapi/#rest-subscriptions

Retrieving the user

The getSubUser operation retrieves the user.

getSubUser
<yammer.getSubUser>
	<userId>{$ctx:userId}</userId>
</yammer.getSubUser>
Properties
  • userId: The ID of the user.
Sample request

Following is a sample REST/JSON request that can be handled by the getSubUser operation.

Sample Request for getSubUser
{
	"apiUrl":"https://www.yammer.com",
	"apiToken":"bwGBT89WMbAwefDZHVaZA",
	"responseType":"json",
	"userId":"1530172115"
}
Related Yammer documentation
https://developer.yammer.com/restapi/#rest-subscriptions

Sample configuration

Following is a sample proxy service that illustrates how to connect to Yammer with the init operation and use the addSubscription operation. The sample request for this proxy can be found in the addSubscription sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="yammer_addSubscription"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="apiToken" expression="json-eval($.apiToken)"/>
         <property name="responseType" expression="json-eval($.responseType)"/>
         <property name="targetType" expression="json-eval($.targetType)"/>
		 <property name="targetId" expression="json-eval($.targetId)"/>
         <yammer.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <apiToken>{$ctx:apiToken}</apiToken>
            <responseType>{$ctx:responseType}</responseType>
         </yammer.init>
         <yammer.addSubscription>
            <targetType>{$ctx:targetType}</targetType>
			<targetId>{$ctx:targetId}</targetId>
         </yammer.addSubscription>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>