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

Overview

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

OperationDescription

getUserCommentsHistory

Retrieves comments things information of the user.

getUserSavedHistory

Retrieves saved things information of the user.

getUserUpvotedHistory

Retrieves the upvoted things history of the user.

getUserDownvotedHistory

Retrieves the Downvoted things history of the user.

Operation details

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

Restart the server and deploy the Reddit configuration.

init
<reddit.init>
	<accessToken>42591910-APa9HJeLE1jV2EjpIxigdTi79mw</accessToken>
</reddit.init>

Get information of a comments

To retrieves the comments history of the user, use <reddit.getUserCommentsHistory> operation.

Sample Request for getUserCommentsHistory
<reddit.getUserCommentsHistory>
   <after>t1_cubnofc</after>
   <before>t1_ctw09rp</before>
   <count>0</count>
   <userName>kanapriya</userName>
   <limit>25</limit>
   <show>given</show>
   <sort>new</sort>
   <srDetail>yes</srDetail>
   <time>all</time>
</reddit.getUserCommentsHistory>

Get information of a saved history

To retrieves the saved history of the user, use <reddit.getUserSavedHistory> operation.

Sample Request for getUserSavedHistory
<reddit.getUserSavedHistory>
     <after>t1_cubkrzk</after>
     <before>t3_3gtks5</before>
     <count>0</count>
     <userName>kanapriya</userName>
     <limit>25</limit>
     <show>given</show>
     <sort>new</sort>
  	 <srDetail>yes</srDetail>
   	 <time>all</time>
</reddit.getUserSavedHistory>

Get information of a upvoted history

To retrieves the upvoted history of the user, use  <reddit.getUserUpvotedHistory> operation.

Sample Request for getUserUpvotedHistory
<reddit.getUserUpvotedHistory>
     <after>t3_3hxrlz</after>
     <before>t3_3g4plh</before>
     <count>0</count>
     <userName>kanapriya</userName>
     <limit>25</limit>
     <show>given</show>
     <sort>new</sort>
  	 <srDetail>yes</srDetail>
   	 <time>all</time>
 </reddit.getUserUpvotedHistory>

Get information of a downvoted history

To retrieves the upvoted history of the user, use  <reddit.getUserDownvotedHistory> operation.

Sample Request for getUserDownvotedHistory
 <reddit.getUserDownvotedHistory>
     <after>t3_3g5a5t</after>
     <before>t3_3g48cz</before>
     <count>0</count>
     <userName>kanapriya</userName>
     <limit>25</limit>
     <show>given</show>
     <sort>new</sort>
  	 <srDetail>yes</srDetail>
   	 <time>all</time>
</reddit.getUserDownvotedHistory>

Properties

  • after: Fullname of a thing
  • before: Fullname of a thing
  • count: A positive integer (default: 0)
  • userName: Existing Reddit user name
  • 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)

Sample configuration

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

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="reddit_getUserCommentsHistory"
       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="sort" expression="json-eval($.sort)"/>
			<property name="srDetail" expression="json-eval($.srDetail)"/>
			<property name="time" expression="json-eval($.time)"/>
			<property name="userName" expression="json-eval($.userName)"/>
            <reddit.init>
                   <accessToken>{$ctx:accessToken}</accessToken>
             </reddit.init>
              <reddit.getUserCommentsHistory>
                        <after>{$ctx:after}</after>
                        <before>{$ctx:before}</before>
                        <count>{$ctx:count}</count>
                        <userName>{$ctx:userName}</userName>
                        <limit>{$ctx:limit}</limit>
                        <show>{$ctx:show}</show>
                        <sort>{$ctx:sort}</sort>
                        <srDetail>{$ctx:srDetail}</srDetail>
                        <time>{$ctx:time}</time>
               </reddit.getUserCommentsHistory>
            <respond/>
        </inSequence>
        <outSequence>
            <log/>
            <send/>
        </outSequence>
    </target>
    <description/>
</proxy>