Versions Compared

Key

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

...

Anchor
Overview
Overview
Overview

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

OperationDescription
getCurrentUserInfoRetrieves the Reddit user information.
getCurrentUserTrophiesRetrieves the reddit user trophies.
getCurrentUserPreferencesRetrieves the current user preferences.

 
Anchor
OperationDetails
OperationDetails
Operation details

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

Restart the server and deploy the Reddit configuration.

Code Block
languagexml
titleinit
 <reddit.init>
  	<apiVersion>v1</apiVersion>
  	<apiUrlOauth>https://oauth.reddit.com</apiUrlOauth>
  	<accessToken>42591910-zkzl5EOCq19Duy8pScRgaPBiwSw</accessToken>
</reddit.init>

Anchor
getCurrentUserInfo
getCurrentUserInfo
Get information of a user

To retrieves the user info , use <reddit.getCurrentUserInfo/> operation.

Code Block
languagexml
titleSample Request for getCurrentUserInfo
<reddit.getCurrentUserInfo/>

Anchor
getCurrentUserTrophies
getCurrentUserTrophies
Get trophies information of a user

To retrieves the user info , use <reddit.getCurrentUserTrophies/> operation.

Code Block
languagexml
titleSample Request for getCurrentUserTrophies
<reddit.getCurrentUserTrophies/>

Anchor
getCurrentUserPreferences
getCurrentUserPreferences
Get preferences information of a user

To retrieves the user info , use <getCurrentUserPreferences/> operation.

Code Block
languagexml
titleSample Request for getCurrentUserPreferences
<getCurrentUserPreferences/> 

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 getCurrentUserPreferences operation. The sample request for this proxy can be found in getCurrentUserPreferences sample request.

Code Block
titleSample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="reddit_getCurrentUserPreferences"
       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="apiVersion" expression="json-eval($.apiVersion)"/>
           <reddit.init>
                <apiUrlOauth>{$ctx:apiUrlOauth}</apiUrlOauth>
                <apiVersion>{$ctx:apiVersion}</apiVersion>
                <accessToken>{$ctx:accessToken}</accessToken>
            </reddit.init>
           <reddit.getCurrentUserPreferences/>
            <respond/>
        </inSequence>
        <outSequence>
            <log/> 
        </outSequence>
    </target>
    <description/>
</proxy>