Endpoint: captcha

This might not be a Google Captcha, but it is at least still here and working. The history is that the functionality was created before other captchas (like reCaptcha) was offered to humanity.

All captchas are valid in 5 minutes after requesting them.

Getting the captcha

Using captchas are currently free of usage. The API module is quite simple built: Requesting a captcha from /3.0/captcha/ will return a hash and an image url. You can also call for the captcha with /captcha/getCaptcha (works for APIv2 also).

The getCaptchaResponse looks like this:

captchaResponse
{
	"captchaResponse": {
		"imageUrl": "https://api.tornevall.com/3.0/captcha/getImage/hash/82be5f5b1eadcf43ae556ada6536d949fae1432c",
		"imageHash": "82be5f5b1eadcf43ae556ada6536d949fae1432c",
		"date": "2018-07-14 09:52:48"
	}
}
Response Parameter KeyResponse Parameter Value
imageUrlThe URL that you want to display as an image src on your site
imageHashThe hash string linked to the imageUrl, that must be used when testing the captcha
dateIndicates from which date and time the captcha and string has been created (from this date/time the captcha is valid in 5 minutes)

Example of a captcha rendered by the captchaApi:

Additional responses

By running /captcha/getCaptcha, your response will instead be something like below:

getCaptchaResponse
"response": {
        "getCaptchaResponse": {
            "imageUrl": "https:\/\/api.tornevall.net\/2.0\/captcha\/getImage\/hash\/f3d5f4f46bbf12cefda8398eb09d07e42b117245",
            "imageHash": "f3d5f4f46bbf12cefda8398eb09d07e42b117245"
        }
    }

Test the captcha string

Testing this string against the captchaApi is being made either through

{
	"hash": "theImageHashString",
	"response": "theImageContentString"
}

Or with a GET-request immediately (which is not recommended) like this: /3.0/captcha/testcaptcha/hash/theImageHashString/response/theImageContentString

Also, a simple HTTP post request to /3.0/captcha/testcaptcha works, where the body could look like this

hash=theImageHashString&response=theImageContentString


In this case, the response of this query will be:

testCaptchaResponse
{
    "response": {
        "testCaptchaResponse": "1"
    }
}

If the control instead fails, the response will throw back an exception with error code 2003: TAPI_PLUGIN_CAPTCHA_STRING_MISMATCH

Mismatch Captcha
{
  "response": [],
  "errors": {
    "code": "401",
    "success": "",
    "faultstring": "Captcha test failed"
  }
}


Get the image for a specific hash

As the URLs above reveals, getImage() is used to show a generated captcha image. Using /getImage/<hashString> will give you the image. For the example below, you'll get "test", since hashes expires after 5 minutes and will not be available for viewing after this.

/3.0/captcha/getImage/hashString