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/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

[ Overview ] [ Operation details ] [ Sample configuration ]

Overview

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

OperationDescription
getUserInboxMessagesRetrieves the inbox messages of the user.
getUserSentMessagesInfoRetrieves the sent messages of the user.
getUserNotificationsRetrieves the notifications of the user.

Operation details

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

Restart the server and deploy the Reddit configuration.

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

Get information of a user inbox messages

To retrieves the inbox messages of the user, use <reddit.getUserInboxMessages> operation.

Sample Request for getUserInboxMessages
<reddit.getUserInboxMessages>
   	<after>1_cu7fp83</after>
    <before>t1_ctw5sns</before>
    <count>0</count>
    <mark>true</mark>
    <limit>25</limit>
    <show>all</show>
    <mid>{$ctx:mid}</mid>
   	<srDetail>yes</srDetail>
</reddit.getUserInboxMessages>

Get information of a user sent messages

To retrieves the sent messages of the user, use <reddit.getUserSentMessagesInfo> operation.

Sample Request for getUserSentMessagesInfo
<reddit.getUserSentMessagesInfo>
    <after>t4_3wdt8g</after>
    <before>t4_3w7lcd</before>
    <count>0</count>
    <mark>true</mark>
    <limit>25</limit>
    <show>all</show>
    <mid>{$ctx:mid}</mid>
   	<srDetail>yes</srDetail>
</reddit.getUserSentMessagesInfo>

Get information of a user notifications

To retrieves the notifications of the user, use <reddit.getUserNotifications> operation.

Sample Request for getUserNotifications
<reddit.getUserNotifications>
     <count>0</count>
     <endDate>1439291258</endDate>
     <startDate>1439014025</startDate>
     <sort>new</sort>
</reddit.getUserNotifications>
Properties
  • after: Fullname of a thing(start thing_id of the message)

  • before: Fullname of a thing

  • count: A positive integer (default: 0)

  • mark: A boolean value(true or false)

  • 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

  • mid: Mid thing_id of the message

  • endDate: End date of the notifications

  • startDate: Start date of the notifications

Sample configuration

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

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