mike revised this gist . Go to revision
1 file changed, 9 insertions, 1 deletion
CaptchaApiService.md
@@ -2,10 +2,18 @@ | |||
2 | 2 | Methods; | |
3 | 3 | ||
4 | 4 | ## Generate Challenge | |
5 | - | `https://api.alveus.dev/captcha/v1/challenge?apiKey=xxxx:xxxx` | |
5 | + | `https://api.alveus.dev/captcha/v1/challenge` | |
6 | 6 | ||
7 | 7 | Generates a challenge and returns the answer symbol, the symbol name, and the captcha image as a base64 encoded jpeg image. | |
8 | 8 | ||
9 | + | ## API Key | |
10 | + | ||
11 | + | Api key can be provided in one of two ways; | |
12 | + | ||
13 | + | URL Paramater: `https://api.alveus.dev/captcha/v1/challenge?apiKey=xxxxx:xxxxx` | |
14 | + | ||
15 | + | Header: `x-api-key=xxxxx:xxxxx` | |
16 | + | ||
9 | 17 | ### Successful Response: | |
10 | 18 | ||
11 | 19 | ```json |
mike revised this gist . Go to revision
1 file changed, 2 insertions
CaptchaApiService.md
@@ -14,6 +14,7 @@ Generates a challenge and returns the answer symbol, the symbol name, and the ca | |||
14 | 14 | "data": { | |
15 | 15 | "symbol": "<symbol>", | |
16 | 16 | "symbolName": "<name of symbol>", | |
17 | + | "generator": 1, | |
17 | 18 | "imageData": "data:image/jpeg;base64,...." | |
18 | 19 | } | |
19 | 20 | } | |
@@ -22,6 +23,7 @@ Generates a challenge and returns the answer symbol, the symbol name, and the ca | |||
22 | 23 | - `success`: A boolean of true when successful. | |
23 | 24 | - `symbol`: The symbol (i.e. emoji) that is the correct answer. | |
24 | 25 | - `symbolName`: The name of a symbol (i.e. "popcorn"). | |
26 | + | - `generator`: The image generator version. | |
25 | 27 | - `imageData`: Base64 encoded image data. | |
26 | 28 | ||
27 | 29 |
mike revised this gist . Go to revision
1 file changed, 44 insertions
CaptchaApiService.md(file created)
@@ -0,0 +1,44 @@ | |||
1 | + | # Captcha API Service | |
2 | + | Methods; | |
3 | + | ||
4 | + | ## Generate Challenge | |
5 | + | `https://api.alveus.dev/captcha/v1/challenge?apiKey=xxxx:xxxx` | |
6 | + | ||
7 | + | Generates a challenge and returns the answer symbol, the symbol name, and the captcha image as a base64 encoded jpeg image. | |
8 | + | ||
9 | + | ### Successful Response: | |
10 | + | ||
11 | + | ```json | |
12 | + | { | |
13 | + | "success": true, | |
14 | + | "data": { | |
15 | + | "symbol": "<symbol>", | |
16 | + | "symbolName": "<name of symbol>", | |
17 | + | "imageData": "data:image/jpeg;base64,...." | |
18 | + | } | |
19 | + | } | |
20 | + | ``` | |
21 | + | ||
22 | + | - `success`: A boolean of true when successful. | |
23 | + | - `symbol`: The symbol (i.e. emoji) that is the correct answer. | |
24 | + | - `symbolName`: The name of a symbol (i.e. "popcorn"). | |
25 | + | - `imageData`: Base64 encoded image data. | |
26 | + | ||
27 | + | ||
28 | + | ### Unsuccessful Response: | |
29 | + | ```json | |
30 | + | { | |
31 | + | "success": false, | |
32 | + | "error": "<error code>", | |
33 | + | "message": "<human error message>" | |
34 | + | } | |
35 | + | ``` | |
36 | + | ||
37 | + | - `success`: A boolean of false indicating that the request failed. | |
38 | + | - `error`: An error code (See below). | |
39 | + | - `message`: A humanised message describing the error. | |
40 | + | ||
41 | + | ### Error codes: | |
42 | + | ||
43 | + | - `unauthorized`: The provided API key is invalid. | |
44 | + | - `unknown_error`: An unknown error has occured. |