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 Subreddit Scope

[ Overview ] [ Operation details ] [ Sample configuration ]

Overview

The following operations allow you to work with Subredit scope in Reddit. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with Subredit scope, see Sample configuration.

OperationDescription

getUserSubredditInfo

Retrieves subreddits information of the user.

getSubredditKarma

Retrieves karma points of the user.

getUserModeratorSubreddit

Retrieves moderator information of the user.

Operation details

This section provides the details on each operation related to Subreddit scope.

Restart the server and deploy the Reddit configuration.

init
<reddit.init>
	<apiUrlOauth>{$ctx:apiUrlOauth}</apiUrlOauth>
   	<apiVersion>{$ctx:apiVersion}</apiVersion>
  	<accessToken>{$ctx:accessToken}</accessToken>
</reddit.init>

Get subreddit information of the user

To retrieves the subreddits of the user, use <reddit.getUserSubredditInfo/> operation.

Sample Request for getUserSubredditInfo
<reddit.getUserSubredditInfo/>

Get subreddit karma points information of the user

To retrieves the subreddits karma points of the user, use <reddit.getSubredditKarma/> operation.

Sample Request for getSubredditKarma
<reddit.getSubredditKarma/>

Get moderator information of the user

To retrieves the moderator information of the user, use <getUserModeratorSubreddit> operation.

Sample Request for getUserModeratorSubreddit
<reddit.getUserModeratorSubreddit>
   <after>t1_cu7fp83</after>
   <before>t1_ctw5sns</before>
   <count>0</count>
   <limit>25</limit>
   <show>all</show>
   <srDetail>yes</srDetail>
</reddit.getUserModeratorSubreddit>
Properties
  • after: Fullname of a thing
  • before: Fullname of a thing
  • count: A positive integer (default: 0)
  • limit: The maximum number of items desired (default: 25, maximum: 100)
  • show: Show whether the string all or not
  • srDetail: Expand subreddits

Sample configuration

Following is a sample proxy service that illustrates how to connect to Reddit with the init operation to use the getUserModeratorSubreddit operation. The sample request for this proxy can be found in getUserModeratorSubreddit sample request.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="reddit_getUserModeratorSubreddit"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
    <target>
        <inSequence>
            <property name="accessToken" expression="json-eval($.accessToken)"/>
			<property name="after" expression="json-eval($.after)"/>
			<property name="before" expression="json-eval($.before)"/>
			<property name="count" expression="json-eval($.count)"/>
			<property name="limit" expression="json-eval($.limit)"/>
			<property name="show" expression="json-eval($.show)"/>
			<property name="srDetail" expression="json-eval($.srDetail)"/>
			<reddit.init>
    			<accessToken>{$ctx:accessToken}</accessToken>
 			</reddit.init>
 			<reddit.getUserModeratorSubreddit>
   				<after>{$ctx:after}</after>
   				<before>{$ctx:before}</before>
  				<count>{$ctx:count}</count>
   				<limit>{$ctx:limit}</limit>
   				<show>{$ctx:show}</show>
   				<srDetail>{$ctx:srDetail}</srDetail>
 			</reddit.getUserModeratorSubreddit>
            <respond/>
        </inSequence>
        <outSequence>
            <log/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>