Disqus API 添加评论

发布于 2024-10-09 19:31:10 字数 583 浏览 6 评论 0原文

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

我正在使用 create 提交评论。我正在使用 API 控制台来尝试一下。我添加了author_id、author_email、评论,但我不确定要添加到线程论坛中。我尝试了我的帖子 ID (256) http://www.myblog.com/?p= 256 但这会返回..

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

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

I'm trying to submit a comment to my blog from another site via the Disqus API.

I'm using create to submit a comment. I'm using the API console to try it out. I added an author_id, author_email, comment but I'm not sure what to add to thread or forum. I tried my post id (256) http://www.myblog.com/?p=256 but that returns..

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

Can anyone who used the API please tell me how to create comments?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

偷得浮生 2024-10-16 19:31:10

请记住,“线程”正在寻找的默认值是 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

Keep in mind that the default value that 'thread' is looking for is a Disqus internal thread ID (rather than the Wordpress ID in your case). However, you can use the custom disqus_identifier that is set via the Wordpress plugin (look for that value in the source code of your blog post), or the URL associated with the thread if you pass forum=YOUR_SHORTNAME in addition.

So here's how you can select a thread:

// 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
别再吹冷风 2024-10-16 19:31:10

您需要向我认为注册了调用 API 的应用程序的“用户”授予写入权限。

请参阅此处:http://disqus.com/api/docs/permissions/

You need to give the 'user' who i presume registered the application thats calling the API write permissions.

See here: http://disqus.com/api/docs/permissions/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文