Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
typeflat

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 https://api.tornevall.net/2/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:

Code Block
languagejs
titlecaptchaResponse
"response": {
        	"captchaResponse": {
            		"imageUrl": "https:\/\/api.tornevall.net\com/23.0\/captcha\/getImage\/hash\/b437802a590d7fb50030eb5e4d3522ed61369f0c82be5f5b1eadcf43ae556ada6536d949fae1432c",
            		"imageHash": "b437802a590d7fb50030eb5e4d3522ed61369f0c82be5f5b1eadcf43ae556ada6536d949fae1432c",
		"date":        }
    "2018-07-14 09:52:48"
	}
}


Response Parameter KeyResponse Parameter Value
imageUrlThe url of where you can find the captcha imageURL that you want to display as an image src on your site
imageHashThe hash string that you use for matching the captcha stringlinked 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:

...

Testing this string against the captchaApi is being made either through (example): https://api.tornevall.net/2.

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

Or with a GET-request immediately (which is not recommended) like this: /3.0/captcha/testcaptcha/hash/<imageHash>theImageHashString/response/q23lqctg or https://api.tornevall.net/2.theImageContentString

Also, a simple HTTP post request to /3.0/captcha/testcaptcha and the rest as POST-content or JSON. works, where the body could look like this

No Format
hash=theImageHashString&response=theImageContentString


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

...

Code Block
languagejs
titleMismatch Captcha
{
    "response": {
        "responseString": ""
    },
  [],
  "errors": {
        "successcode": "401",
        "faultstringsuccess": "Captcha test failed",
        "actionfaultstring": "",
Captcha        "code": "2003"test failed"
    },
    "api": {
        "endPoint": "captcha",
        "verb": "testCaptcha"
    },
    "request": [],
    "client": []
}


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.

https://api.tornevall.net/2/3.0/captcha/getImage/test

An alternative to this is to use /captcha/getImage/hash/<hashString>

...

titleCaptcha Expiration

...

hashString