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);

    '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

Written on July 11, 2013