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



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

OperationDescription

createThread

Creates a new thread.

getThreadDetailsReturns thread details.
listThreadsReturns a list of threads.
subscribeSubscribes 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.

createThread
 <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: The ID of the Disqus forum to retrieve.
  • title: The title of the thread to create.
  • categoryId: The ID of the category to create the thread in.
  • url: The URL (defined by RFC 3986).
  • date: The UNIX time stamp (or ISO date time standard).
  • message: The message to put in the created thread.
  • identifier: An identifier. Maximum length of 300.
  • slug: The alpha-numeric slug.
Sample request

Following is a sample REST/JSON request that can be handled by the createThread operation.

Sample Request for createThread
{
    "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. 

getThreadDetails
<disqus.getThreadDetails>
    <forumId>{$ctx:forumId}</forumId>
    <related>{$ctx:related}</related>
	<threadId>{$ctx:threadId}</threadId>
</disqus.getThreadDetails>
Properties
  • forumId: The ID of the Disqus forum to retrieve the thread from.
  • related: Specifies relations to include with your response: "forum", "author", and/or "category".
  • threadId: The ID of the thread to retrieve.
Sample request

Following is a sample REST/JSON request that can be handled by the getThreadDetails operation.

Sample Request for getThreadDetails
{
    "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 listThreads 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: The ID of the category whose threads should be retrieved.
  • forumId: The ID of the Disqus forum to retrieve.
  • threadId: The ID of the thread to retrieve.
  • since: The UNIX time stamp (or ISO date time standard).
  • related: Specifies relations to include with your response: "forum" and/or "author".
  • cursor: The pagination parameter.
  • limit: The maximum number of posts to return.
  • include: The types of thread to include: "open", "closed", and/or "killed".
  • order: The order of entries returned: "ASC" or "DESC" (default).

The table below explains how the API endpoint is chosen for the listThreads property based on request parameters. Please refer to the specific endpoints for optional parameters when testing different endpoints.

Priority

Parameter

EP 1

EP 2

EP 3

1

categoryId

provided

-

-

2

forumId

*

provided

-

* Will not be considered when deciding even when a value is supplied in the request. In case of optional parameters, they will be added as they are.

EP 1 endpoint:

https://disqus.com/api/3.0/categories/listThreads.json

EP 2 endpoint:

https://disqus.com/api/3.0/forums/listThreads.json

EP 3 endpoint:

https://disqus.com/api/3.0/trends/listThreads.json

Sample request

Following is a sample REST/JSON request that can be handled by the listThreads operation.

Sample Request for 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 subscribe 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
Sample request

Following is a sample REST/JSON request that can be handled by the subscribe operation.

Sample Request for 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.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<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>                                                             
  • No labels