Overview
The following operations allow you to work with posts. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with posts, see Sample configuration.
Operation | Description |
---|---|
Returns information about a post. | |
1Working with Posts in Disqus | Returns a list of posts. |
Operation details
This section provides further details on the operations related to posts.
Returning information about a post
The getPost
operation returns information about a post.
<disqus.getPost> <related>{$ctx:related}</related> <postId>{$ctx:postId}</postId> </disqus.getPost>
Properties
Related information to return in the response: "forum" and/or "thread".related:
The ID of the post to retrieve.postId:
Sample request
Following is a sample REST/JSON request that can be handled by the getPost operation.
{ "apiUrl": "https://disqus.com", "postId": "1649781407", "apiKey": "hNCiYG7sBpsyavTbpysXNgHKJ8YDb9IFr3LpcVGj3eEZTPCicTJxNBoHub4etovu", "related": "forum,thread" }
Related Disqus documentation
https://disqus.com/api/docs/posts/details/
Returning a list of posts
The listPosts operation returns a list of posts within a forum/category and by users.
<disqus.listPosts> <forumId>{$ctx:forumId}</forumId> <categoryId>{$ctx:categoryId}</categoryId> <since>{$ctx:since}</since> <cursor>{$ctx:cursor}</cursor> <limit>{$ctx:limit}</limit> <query>{$ctx:query}</query> <popular>{$ctx:popular}</popular> <interval>{$ctx:interval}</interval> <offset>{$ctx:offset}</offset> <include>{$ctx:include}</include> <order>{$ctx:order}</order> <related>{$ctx:related}</related> <threadId>{$ctx:threadId}</threadId> <userId>{$ctx:userId}</userId> </disqus.listPosts>
Properties
The ID of the Disqus forum to retrieve.forumId:
The ID of the category whose posts should be retrieved.categoryId:
The UNIX time stamp (or ISO date time standard).since:
The pagination parameter.cursor:
The maximum number of posts to return.limit:
The query to filter the lists that are returned as part of the response.query:
Whether to pick the popular posts.popular:
The interval of posts, one of: 1h, 6h, 12h, 1d, 3d, 7d, 30d, 60d, or 90d.interval:
The offset from the interval.offset:
The types of posts to include: "unapproved", "approved" (default), "spam", "deleted", "flagged", and/or "highlighted".include:
The order of entries returned. Choices: "ASC" or "DESC" (default).order:
Specifies related information to include in the response: "forum" and/or "thread".related:
The ID of the Disqus forum to retrieve.threadId:
The ID of the user whose posts are to be retrieved.userId:
Special Notes
The table below explains how the API endpoint is chosen for the listPosts method based on request parameters. Please refer to the specific end points for optional parameters when testing different end points.
Priority | Parameter | EP 1 | EP 2 | EP 3 | EP 4 | EP 5 |
1 | popular | "true" | - | - | - | - |
2 | threadId | * | provided | - | - | - |
3 | categoryId | * | * | provided | - | - |
4 | forumId | * | * | * | provided | - |
5 | userId/accessToken | * | * | * | * | 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/posts/listPopular.json
EP 2 endpoint:
https://disqus.com/api/docs/threads/listPosts.json
EP 3 endpoint:
https://disqus.com/api/docs/categories/listPosts.json
EP 4 endpoint:
https://disqus.com/api/docs/forums/listPosts.json
EP 5 endpoint:
Sample request
Following is a sample REST/JSON request that can be handled by the listPosts operation.
{ "limit": "10", "cursor": "", "userId": "", "threadId": "3189670846", "order": "", "interval": "", "offset": "", "popular": "", "accessToken": "", "forumId": "", "query": "", "categoryId": "", "apiUrl": "https://disqus.com", "since": "", "apiSecret":"", "apiKey": "hNCiYG7sBpsyavTbpysXNgHKJ8YDb9IFr3LpcVGj3eEZTPCicTJxNBoHub4etovu", "related": "forum,thread", "include": "" }
Related Disqus documentation
https://disqus.com/api/docs/posts/list/
Sample configuration
Following is a sample proxy service that illustrates how to connect to Disqus with the init
operation and use the getPost operation. The sample request for this proxy can be found in the getPost 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_getPost" 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="apiSecret" expression="json-eval($.apiSecret)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="related" expression="json-eval($.related)"/> <property name="postId" expression="json-eval($.postId)"/> <disqus.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <apiKey>{$ctx:apiKey}</apiKey> <apiSecret>{$ctx:apiSecret}</apiSecret> <accessToken>{$ctx:accessToken}</accessToken> </disqus.init> <disqus.getPost> <related>{$ctx:related}</related> <postId>{$ctx:postId}</postId> </disqus.getPost> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>