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

[ Overview ] [ Operation details ] [ Sample configuration ]

Overview

The following operations allow you to work with Read 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 Read scope, see Sample configuration.

OperationDescription

getAnyUserPublicMultisList

Retrieves public multis information of the reddit user.

getCurrentUserMultisList

Retrieves user multis information of the user.

search

Retrieves search information of the user.

Operation details

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

Restart the server and deploy the Reddit configuration.

init
<reddit.init>
	<apiUrlOauth>https://oauth.reddit.com</apiUrlOauth>
 	<accessToken>42591910-APa9HJeLE1jV2EjpIxigdTi79mw</accessToken>
</reddit.init>

Get information of public multis

To retrieves the public multis of the user, use <reddit.getAnyUserPublicMultisList> operation.

Sample Request for getAnyUserPublicMultisList
<reddit.getAnyUserPublicMultisList>
    <userName>Thumperings</userName>
    <expandSrs>true</expandSrs>
</reddit.getAnyUserPublicMultisList>

Get information of current user multis

To retrieves the user multis of the user, use <reddit.getCurrentUserMultisList> operation.

Sample Request for getCurrentUserMultisList
<reddit.getCurrentUserMultisList>
   <expandSrs>true</expandSrs>
</reddit.getCurrentUserMultisList>

Get search thing

To retrieves the search item, use <reddit.search> operation.

Sample Request for search
<reddit.search>
   <after>t3_3hxrlz</after>
   <before>t3_3g4plh</before>
   <count>1</count>
   <includeFacets>true</includeFacets>
   <limit>130</limit>
   <str>string</str>
   <restrictSr>false</restrictSr>
   <show>given</show>
   <sort>hot</sort>
   <srDetail>yes</srDetail>
   <syntax>cloudsearch</syntax>
   <time>all</time>
   <type>{$ctx:type}</type>
</reddit.search>
Properties
  • after: Fullname of a thing
  • before: Fullname of a thing
  • count: A positive integer (default: 0)
  • includeFacets: A boolean value
  • limit: The maximum number of items desired (default: 25, maximum: 100)
  • show: Show whether the string all or not
  • sort: One of (relevance, hot, top, new, comments)
  • srDetail: Expand subreddits
  • time: One of (hour, day, week, month, year, all)
  • type: Comma-delimited list of result types (sr, link)
  • syntax: One of (cloudsearch, lucene, plain)
  • restrictSr: A boolean value
  • str: A string
  • expandSrs: A boolean value
  • userName: Existing Reddit user name

Sample configuration

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

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="reddit_getCurrentUserMultisList"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
    <target>
        <inSequence>
            <property name="accessToken" expression="json-eval($.accessToken)"/>
			<property name="apiUrlOauth" expression="json-eval($.apiUrlOauth)"/>
			<property name="expandSrs" expression="json-eval($.expandSrs)"/>
             		<reddit.init>
                        <apiUrlOauth>{$ctx:apiUrlOauth}</apiUrlOauth>
                        <accessToken>{$ctx:accessToken}</accessToken>
                    </reddit.init>
                    <reddit.getCurrentUserMultisList>
                        <expandSrs>{$ctx:expandSrs}</expandSrs>
                    </reddit.getCurrentUserMultisList>
            <respond/>
        </inSequence>
        <outSequence>
            <log/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>