Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disqus API adding comment

Tags:

json

php

disqus

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?

like image 370
Cyber Junkie Avatar asked Jun 04 '26 18:06

Cyber Junkie


1 Answers

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
like image 145
Ryan V Avatar answered Jun 07 '26 07:06

Ryan V



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!