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 Public Methods

[ Overview ] [ Operation details ] [ Sample configuration ]

Overview

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

OperationDescription

reddit_register

create new reddit account.

redditSetPassword

Set the password for the registered account

Operation details

This section provides the details on each operation related to public methods.

Restart the server and deploy the Reddit configuration.

init
<reddit.init>
	<apiUrl>https://www.reddit.com</apiUrl>
</reddit.init>

Create a new reddit account

To register new reddit account, use <reddit.reddit_register> operation.

Sample Request for reddit_register
<reddit.reddit_register>
   <user>conUser</user>
   <email>xyz@gmail.com</email>
   <password1>123456</password1>
   <password2>123456</password2>
   <destination>Colombo</destination>
   <rem>true</rem>
   <reason>testing</reason>
</reddit.reddit_register>

Set the password of reddit account

To set the password for the reddit account, use <reddit.redditSetPassword> operation.

Sample Request for redditSetPassword
<reddit.redditSetPassword>
     <userName>conUser</userName>
</reddit.redditSetPassword>
Properties
  • user: user name
  • email: Email Address
  • password1: password for account
  • password2: password for account (it should be same as password1)
  • destination: Destination .
  • rem: rem is a boolean value which is need to register new account 
  • reason: Purpose for creating account
  • 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 redditSetPassword operation. The sample request for this proxy can be found in redditSetPassword sample request.

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