Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

[ Overview ] [ Operation details ] [ Sample configuration ]

Anchor
Overview
Overview
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

Anchor
OperationDetails
OperationDetails
Operation details

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

Restart the server and deploy the Reddit configuration.

Code Block
languagexml
titleinit
<reddit.init>
	<apiUrl>https://www.reddit.com</apiUrl>
</reddit.init>

Anchor
reddit_register
reddit_register
Create a new reddit account

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

Code Block
languagexml
titleSample 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>

Anchor
redditSetPassword
redditSetPassword
Set the password of reddit account

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

Code Block
languagexml
titleSample 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

Anchor
sampleconfiguration
sampleconfiguration
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.

Code Block
titleSample 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>

Anchor
sampleconfiguration
sampleconfiguration