| Format | Content Type |
|---|---|
| txt | text/plain |
| json | text/json |
| html | text/html |
LibInsult provides a few different languages, note that different languages might have different default templates.
| Code | Description |
|---|---|
| en | English |
| en_corporate | English corporate jargon |
You can play with the various parameters with the API Explorer.
In case of a successful request, the API will return a 200 page with the insult formatted in the requested format.
In case of incorrect parameters, the API will return a 400 error, the body of the response depends on the format.
A successful responses will contain the following data:
| Name | Value |
|---|---|
| error | false |
| insult | The generated string |
| args | A dictionary listing the parameters used to generate the output, including default values. |
A failed response will have the following:
| Name | Value |
|---|---|
| error | true |
| error_message | A brief message describing the reason for the error. |
Url: /api/insult
Generates an insult in plain text.
| Name | Description | Default |
|---|---|---|
| lang | Language | en |
| template | Insult template | None |
| who | Person to insult, changes the template to third person singular. | None |
| plural | If present (with who) changes the template to third person plural. | None |
Url: /api/insult.html
Generates an insult in one of the supported formats.
| Name | Description | Default |
|---|---|---|
| lang | Language | en |
| template | Insult template | None |
| who | Person to insult, changes the template to third person singular. | None |
| plural | If present (with who) changes the template to third person plural. | None |
Url: /api/en/insult.html
Generates an insult in a fixed language.
| Name | Description | Default |
|---|---|---|
| template | Insult template | None |
| who | Person to insult, changes the template to third person singular. | None |
| plural | If present (with who) changes the template to third person plural. | None |
Url: /api/adjective
Generates a single adjective in plain text.
| Name | Description | Default |
|---|---|---|
| lang | Language | en |
Url: /api/adjective.html
Generates a single adjective in one of the supported formats.
| Name | Description | Default |
|---|---|---|
| lang | Language | en |
Generates a single adjective in a fixed language.
Libinsult by default provides built-int templates, but you can also define your own.
The template language uses SGML-style tags to represent special elements to be generated randomly, all other text is output verbatim.
The following entities are provided to escape special characters:
| Entity | Expansion |
|---|---|
< |
< |
> |
> |
& |
& |
| Attribute | Type | Default | Used in | Description |
|---|---|---|---|---|
min |
int | 1 | all | Minimum number of repetitions of this element |
max |
int | 1 | all | Maximum number of repetitions of this element |
count |
int | 1 | all | Fixed Number of repetitions of this element |
id |
id | (none) | all | Element identifier, used for conjugation. Must be unique within the element |
target |
id | (none) | special | Target element, to help with conjugation of pattern-based special words. |
helper |
id | (none) | special | Secondary target element, to help with conjugation of pattern-based special words. |