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. | |
1Working with Threads in Disqus | Returns thread details. |
1Working with Threads in Disqus | Returns a list of threads. |
1Working with Threads in Disqus | 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
The ID of the Disqus forum to retrieve.forumId:
The title of the thread to create.title:
The ID of the category to create the thread in.categoryId:
The URL (defined by RFC 3986).url:
The UNIX time stamp (or ISO date time standard).date:
The message to put in the created thread.message:
An identifier. Maximum length of 300.identifier:
The alpha-numeric slug.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
The ID of the Disqus forum to retrieve the thread from.forumId:
Specifies relations to include with your response: "forum", "author", and/or "category".related:
The ID of the thread to retrieve.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
The ID of the category whose threads should be retrieved.categoryId:
The ID of the Disqus forum to retrieve.forumId:
The ID of the thread to retrieve.threadId:
The UNIX time stamp (or ISO date time standard).since:
Specifies relations to include with your response: "forum" and/or "author".related:
The pagination parameter.cursor:
The maximum number of posts to return.limit:
The types of thread to include: "open", "closed", and/or "killed".include:
The order of entries returned: "ASC" or "DESC" (default).order:
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:
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
The thread to (un)subscribe from.threadId:
The e-mail of the person subscribing or unsubscribing.email:
Specifies whether to subscribe or unsubscribe. If set to true, the https://disqus.com/api/3.0/threads/subscribe.json method is used to process the request, whereas any other value is processed by https://disqus.com/api/3.0/threads/unsubscribe.json.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.
<?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>