Disqus guest posting via API

While evaluating the Disqus API for things like posting and flagging as a guest, I was baffled by this non-descript error:

{"code":12,"response":"This application cannot create posts on the chosen forum"}

After checking the obvious things (like enabling guest posting and checking my domain settings for my forum and application), I was finally able to solve this using the disqus-php library:

require __DIR__ . '/disqus-php-master/disqusapi/disqusapi.php';

$disqus = new DisqusAPI($secret_key);

print_r($disqus->posts->create(array(
    'thread' => $thread_id,
    'message' => $message,
    'author_name' => $author_name,
    'author_email' => $author_email,
    'api_key' => $api_key,
)));

The catch is that the api_key is NOT the same thing as the public key shown in your Disqus application settings. I actually had to inspect one of the AJAX calls from the Disqus Javascript widget to get the correct api_key:

Disqus AJAX call headers showing the api_key

4 thoughts on “Disqus guest posting via API”

  1. Hey Jonathon

    Thanks for posting this. I am getting the exact same problem and I am struggling since past 1 week to fix that. How can i get the correct API key ?

    Vikram

  2. Hi,
    I need to post comments as Anonymous using disqus API from iPhone mobile application.
    I have created application at http://disqus.com/api/applications/.

    For posting comments, I am sending following parameter & its respective value.

    api_secret – Secret Key of application created above.
    thread – Thread id which is generated dynamically from link.
    author_name
    author_email
    message

    I am getting following error for this.

    {“code”:12,”response”:”This application cannot create posts on the chosen forum”}.

    Please help me if you have any idea about this…

    Thanks…

  3. Works like a charm and saved me a lot of hassle!

    I’ll just leave this here for you lazy people: E8Uh5l5fHZ6gD8U3KycjAIAk46f68Zw7C6eW8WSjZvCLXebZ7p0r1yrYDrLilk2F

Leave a Reply

Your email address will not be published. Required fields are marked *