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 Threads in Disqus
Overview
The following operations allow you to work with threads. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with threads, see Sample configuration.
Operation | Description |
---|---|
Creates a new thread. | |
getThreadDetails | Returns thread details. |
listThreads | Returns a list of threads. |
subscribe | Subscribes and unsubscribes to a thread. |
Operation details
This section provides further details on the operations related to threads.
Creating a thread
The
createThread
operation creates a new thread.
<disqus.createThread> <forumId>{$ctx:forumId}</forumId> <title>{$ctx:title}</title> <categoryId>{$ctx:categoryId}</categoryId> <url>{$ctx:url}</url> <date>{$ctx:date}</date> <message>{$ctx:message}</message> <identifier>{$ctx:identifier}</identifier> <slug>{$ctx:slug}</slug> </disqus.createThread>
Properties
forumId:
title:
categoryId:
url:
date:
message:
identifier:
slug:
Sample request
Following is a sample REST/JSON request that can be handled by the createThread
operation.
{ "message": "This message is for the sake of putting a message.", "title": "EnterpriseJavaBeans23.1", "forumId": "java-ee-forum", "categoryId": "", "apiUrl": "https://disqus.com", "slug": "java1.2", "date": "", "identifier": "ThisIsATestIdentifier", "apiKey": "hNCiYG7sBpsyavTbpysXNgHKJ8YDb9IFr3LpcVGj3eEZTPCicTJxNBoHub4etovu" }
Related Disqus documentation
https://disqus.com/api/docs/threads/create/
Returning thread details
The getThreadDetails operation returns thread details.
<disqus.getThreadDetails> <forumId>{$ctx:forumId}</forumId> <related>{$ctx:related}</related> <threadId>{$ctx:threadId}</threadId> </disqus.getThreadDetails>
Properties
forumId:
related:
threadId:
Sample request
Following is a sample REST/JSON request that can be handled by the getThreadDetails operation.
{ "threadId": "3189670846", "forumId": "java-ee-forum", "apiUrl": "https://disqus.com", "apiKey": "hNCiYG7sBpsyavTbpysXNgHKJ8YDb9IFr3LpcVGj3eEZTPCicTJxNBoHub4etovu", "related": "forum,author,category" }
Related Disqus documentation
https://disqus.com/api/docs/threads/details/
Returning a list of threads
The
operation returns a list of threads within a forum/category sorted by the date created.listThreads
<disqus.listThreads> <categoryId>{$ctx:categoryId}</categoryId> <forumId>{$ctx:forumId}</forumId> <threadId>{$ctx:threadId}</threadId> <since>{$ctx:since}</since> <related>{$ctx:related}</related> <cursor>{$ctx:cursor}</cursor> <limit>{$ctx:limit}</limit> <include>{$ctx:include}</include> <order>{$ctx:order}</order> </disqus.listThreads>
Properties
categoryId:
forumId:
threadId:
since:
related:
cursor:
limit:
include:
order:
Disqus API used to process listThreads
The Disqus API method that is called to process listThreads
depends on the properties provided in the request, as follows:
- If you specify the category ID, the https://disqus.com/api/3.0/categories/listThreads.json method will be called to process the request
- If you specify the forum ID, the https://disqus.com/api/3.0/forums/listThreads.json method will be called
- If both category and forum IDs are specified, the category ID will take precedence and https://disqus.com/api/3.0/categories/listThreads.json will be called
- If neither category or forum ID is specified, https://disqus.com/api/3.0/trends/listThreads.json will be called.
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.
listThreads
{ "limit": "2", "cursor": "", "threadId": "3189670846,3189640441,3189638853", "order": "desc", "forumId": "palaforum", "categoryId": "", "apiUrl": "https://disqus.com", "since": "", "apiKey": "hNCiYG7sBpsyavTbpysXNgHKJ8YDb9IFr3LpcVGj3eEZTPCicTJxNBoHub4etovu", "related": "forum,author", "include": "open,closed,killed" }
Related Disqus documentation
https://disqus.com/api/docs/threads/list/
Subscribing and unsubscribing to a thread
The
operation subscribes to or unsubscribes from a thread.subscribe
<disqus.subscribe> <threadId>{$ctx:threadId}</threadId> <email>{$ctx:email}</email> <subscribe>{$ctx:subscribe}</subscribe> </disqus.subscribe>
Properties
threadId:
email:
subscribe:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.subscribe
{ "threadId": "3189670846", "subscribe": "true", "email": "virtusa.wso2.connector@gmail.com", "apiUrl": "https://disqus.com", "apiKey": "hNCiYG7sBpsyavTbpysXNgHKJ8YDb9IFr3LpcVGj3eEZTPCicTJxNBoHub4etovu" }
Related Disqus documentation
https://disqus.com/api/docs/threads/subscribe/
Sample configuration
Following is a sample proxy service that illustrates how to connect to Disqus with the init
operation and use the createThread operation. The sample request for this proxy can be found in the createThread sample request. You can use this sample as a template for using other operations in this category.
<proxy name="disqus_createThread" startOnLoad="true" statistics="disable" trace="disable" transports="https,http" xmlns="http://ws.apache.org/ns/synapse"> <target> <inSequence onError="faultHandlerSeq"> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="apiKey" expression="json-eval($.apiKey)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="forumId" expression="json-eval($.forumId)"/> <property name="title" expression="json-eval($.title)"/> <property name="categoryId" expression="json-eval($.categoryId)"/> <property name="url" expression="json-eval($.url)"/> <property name="date" expression="json-eval($.date)"/> <property name="message" expression="json-eval($.message)"/> <property name="identifier" expression="json-eval($.identifier)"/> <property name="slug" expression="json-eval($.slug)"/> <disqus.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <apiKey>{$ctx:apiKey}</apiKey> </disqus.init> <disqus.createThread> <accessToken>{$ctx:accessToken}</accessToken> <forumId>{$ctx:forumId}</forumId> <title>{$ctx:title}</title> <categoryId>{$ctx:categoryId}</categoryId> <url>{$ctx:url}</url> <date>{$ctx:date}</date> <message>{$ctx:message}</message> <identifier>{$ctx:identifier}</identifier> <slug>{$ctx:slug}</slug> </disqus.createThread> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>