HelloCaptcha service API
This page describes the HelloCaptcha service API. The API calls are based on HTTP and JSON. HelloCaptcha service is the interface for websites that are using our CAPTCHAs.
Requests
- The functions of the service are done by the unique URL of each function.
- The URLs are defined in the HelloCaptcha.class.php file.
- The parameters passed to the service are passed in CGI variables.
Results
- The answer of a HelloCaptcha service function is a JSON encoded associative array. The array consitsts of two parts: data and exception. The data part contains the result of a function. The exception part contains the accidentally occurred exception.
- The advantage of this method is that the client library can throw the exception on the other side. This way the error handling can traverse between the servers. A custom client library can handle the error in a different way.
- The data part is the return result of the function. The type of the result is described at the documentation of the functions.
The functions of HelloCaptcha service
- Description – This function should be called if someone needs a new CAPTCHA. By calling this method the HelloCaptcha server selects a test from the test pool and returns information for displaying a CAPTCHA.
- Parameters
- profileid – The id of the HelloCaptcha profile to display. A profile id can be created by registering on www.hellocaptcha.com, and creating a profile on the admin menu.
- Exceptions
- Throws an exception if
- The profile named profileid does not exist.
- There is no pre-rendered CAPTCHA in the profile pool, yet. Please wait, until HelloCaptcha server generates the CAPTCHA animations.
- Result
- turingtestid – The id of the Turing test. When verifying the answer of the website visitor, this id must be passed to the HelloCaptcha server, in order to know to what to match against the answer.
- html – The HTML code for a standard HelloCaptcha box. The HTML code is provided by HelloCaptcha server. This way we can easily upgrade the visualization. Using this code is not necessary. Anyone can create a custom CAPTCHA box by using the information returned by this function.
- profile_technology – Defines the technology the CAPTCHA uses for displaying itself. HelloCaptcha uses animated GIF images. If the technology is animated GIF, then this value contains: “animated gif”. This variable is for later extension.
- profile_details – This key contains an associative array. The array holds the details of the profile.
- The animated gif case:
- image_src – The URL to the image of the CAPTCHA. The URL points to an animated GIF.
- image_width – The width of the image.
- image_height – The height of the image.
- Description – The answer of a visitor can be checked by using this function.
- Parameters
- turingtestid – The id of the Turing test. An id can be created using getNewTest function.
- answer – The answer for the CAPTCHA that needs to be verified.
- Exceptions
- Throws an exception if
- The Turing test identified by turingtestid does not exist.
- Either test turingtestid or answer is empty.
- The Turing test was already verified once.
- The Turing test is expired.
- There are too many bad tries (on a retryable CAPTCHA).
- Result
- is_valid – A boolean value specifying whether the answer is right.