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 16 Next »

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.

  Operation details

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

Restart the server and deploy the Reddit configuration.

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

Get information of a user

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

Sample Request for getCurrentUserInfo
<reddit.getCurrentUserInfo/>

Get trophies information of a user

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

Sample Request for getCurrentUserTrophies
<reddit.getCurrentUserTrophies/>

Get preferences information of a user

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

Sample Request for getCurrentUserPreferences
<getCurrentUserPreferences/> 

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.

Sample 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>

 

 

 

  • No labels