Testing Comments

To test a comment against our service you should POST a JSON-encoded hash to the following URL:

  • http://test.blogspam.net:9999/

The hash will have keys/values based upon the comment the user has submitted.

Parameters

NameDescription
commentThe body of the submitted comment.required
ipThe IP address the comment was submitted from.required
agentThe user-agent the submitter supplied.
emailThe email address the submitter supplied.
linkThe homepage link the submitter supplied.
nameThe name the submitter supplied.
optionsAdditional options to control how things should work.
siteA link to your site. This same parameter is also used for the getStats() function.required
subjectThe subject/title the submitter supplied.
versionThe version of the plugin that you're using, if any.

Customizing The Testing

In the parameter table above you'll notice there is an "options" parameter. You may submit a number of flags in this field to affect the testing of your submitted comment.

Set the value of this parameter to a comma-separated string - with the following possible components:

NameDescriptionDefault
blacklist=1.2.3.4Blacklist the given IP (*)
exclude=fooDon't run the plugin test "foo" (**)
failIf you pass this option your query will always return a SPAM result.
Useful for testing.
whitelist=1.2.3.4Whitelist the given IP (*)
mandatory=subject Specify that the given field should always be present.
See the table on above for valid field names.
max-links=5The comment body must contain fewer than 5 links10
max-size=2kThe comment body must be smaller than 2k to be approved.
min-size=2kThe comment body must be at least 2k to be approved.
min-words=10The comment body must contain at least 10 words to be approved.4

[*] - You may use either a literal IP address ("192.168.1.1") or a CIDR range ("192.168.1.0/8").

[**] - You can find the list of plugin names via calling the get plugins endpoint.

Results

The result will be returned as a JSON-encoded hash, that hash will contain the following keys:

KeyMeaning
result

The result of the test - one of "ERROR", "OK" or "SPAM".

reason

This field might be present in any response, but it is particularly useful if the tested result result was SPAM or ERROR, where it can be expected to describe (briefly) why the comment was rejected.

blocker

This is a field that describes the name of the plugin, if any, which rejected a comment. Plugins can be disabled selectively when you're submitting comments so this information is potentially useful.

version

The version of the API.

Here are two example results:

Spam:

{"result":"SPAM",
 "reason":"Posting links listed in surbl.org",
 "blocker":"20-ip.js",
 "version":"2.0"}

OK:

{"result":"OK",
 "version":"2.0"}