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.
Operation | Description |
---|---|
getCurrentUserInfo | Retrieves the Reddit user information. |
getCurrentUserTrophies | Retrieves the reddit user trophies. |
getCurrentUserPreferences | Retrieves 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.
<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.
<reddit.getCurrentUserInfo/>
Get trophies information of a user
To retrieves the user info , use <reddit.getCurrentUserTrophies/> operation.
<reddit.getCurrentUserTrophies/>
Get preferences information of a user
To retrieves the user info , use <getCurrentUserPreferences/> operation.
<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.
<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>