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 Relationships in Yammer



Overview

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

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

OperationDescription

addRelationship

Creates a new relationship.

deleteRelationshipDeletes an existing relationship.
getRelationshipRetrieves the relationships.

Operation details

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

Creating a relationship

The addRelationship operation creates a relationship.

addRelationship
<yammer.addRelationship>
    <type>{$ctx:type}</type>
    <email>{$ctx:email}</email>
	<userId>{$ctx:userId}</userId>
</yammer.addRelationship>
Properties
  • type: The type of the relationship: "subordinate", "superior", or "colleague".
  • email: The e-mail address of the user.
  • userId: The ID of the user other than the logged-in user.
Sample request

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

Sample Request for addRelationship
{
	"apiUrl":"https://www.yammer.com",
	"apiToken":"xDH2yacFLuo1yfjTYsoHA",
	"responseType":"json",
	"type":"subordinate",
	"email":"anuradhika@chamath.onmicrosoft.com",
	"userId":"1530177481"
}

Deleting an existing relationship

The deleteRelationship operation deletes an existing relationship. 

deleteRelationship
<yammer.deleteRelationship>
    <userId>{$ctx:userId}</userId>
	<type>{$ctx:type}</type>
</yammer.deleteRelationship>
Properties
  • userId: The ID of the user.
  • type: The type of the relationship: "subordinate", "superior", or "colleague".
Sample request

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

Sample Request for deleteRelationship
{
	"apiUrl":"https://www.yammer.com",
	"apiToken":"xDH2yacFLuo1yfjTYsoHA",
	"responseType":"json",
	"userId":"1530177481",
	"type":"superior"
}

Retrieving the relationships

The getRelationship operation retrieves the relationships. 

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

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

Sample Request for getRelationship
{
	"apiUrl":"https://www.yammer.com",
	"apiToken":"xDH2yacFLuo1yfjTYsoHA",
	"responseType":"json",
	"userId":"1530177481"
}

Sample configuration

Following is a sample proxy service that illustrates how to connect to Yammer with the init operation and use the addRelationship operation. The sample request for this proxy can be found in the addRelationship 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_addRelationship"
       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="type" expression="json-eval($.type)"/>
         <property name="email" expression="json-eval($.email)"/>
         <property name="userId" expression="json-eval($.userId)"/>
         <yammer.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <apiToken>{$ctx:apiToken}</apiToken>
            <responseType>{$ctx:responseType}</responseType>
         </yammer.init>
         <yammer.addRelationship>
            <type>{$ctx:type}</type>
            <email>{$ctx:email}</email>
            <userId>{$ctx:userId}</userId>
         </yammer.addRelationship>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>