php - Disqus API 添加评论

标签 php json api disqus

我正在尝试通过 Disqus API 从另一个站点向我的博客提交评论.

我正在使用 create提交评论。我正在使用 API 控制台进行试用。我添加了 author_id、author_email、评论,但我不确定要将什么添加到 threadforum。我尝试了我的帖子 ID (256) http://www.myblog.com/?p= 256 但返回..

{
  "code": 2, 
  "response": "Invalid argument, 'thread': User does not have write privileges on thread '256'"
}

任何使用过该 API 的人都可以告诉我如何创建评论吗?

最佳答案

请记住,'thread' 正在寻找的默认值是 Disqus 内部线程 ID(而不是您的情况下的 Wordpress ID)。但是,您可以使用通过 Wordpress 插件设置的自定义 disqus_identifier(在您的博客文章的源代码中查找该值),或者如果您传递 则与线程关联的 URL forum=YOUR_SHORTNAME 另外。

下面是您如何选择一个线程:

// Example using Disqus internal ID
POST https://disqus.com/api/3.0/posts/create.json
(your arguments)...
thread=12345678

// Example using disqus_identifier
POST https://disqus.com/api/3.0/posts/create.json 
(your arguments)...
thread=ident:256 http://www.myblog.com/?p=256 // This is the schema used in the WP plugin
forum=YOUR_SHORTNAME

// Example using URL (this is the least reliable)
POST https://disqus.com/api/3.0/posts/create.json 
(your arguments)...
thread=link:http://www.myblog.com/some_slug
forum=YOUR_SHORTNAME

关于php - Disqus API 添加评论,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4549282/

相关文章:

php - 将标准对象数组从 SOAP 循环到数据库 PHP

java - 用于处理 DateTime 的 CustomJacksonMapper 配置在 Spring 4.1.5 上不起作用

Angular - 根据所选项目搜索数据

windows - 从 Windows 服务更改显示分辨率 (Windows 7)

php - 在 XAMPP 中找不到 php.ini 文件

php - 如何判断非英文字符串是否为大写?

javascript - mysql 日期返回奇怪的字符

java - boolean 字段的反序列化和验证

ios - 解析嵌套的 JSON 条目

java - Face++ 比较 API