Insult API

Formats

FormatContent Type
txttext/plain
jsontext/json
htmltext/html

Languages

LibInsult provides a few different languages, note that different languages might have different default templates.

CodeDescription
enEnglish
en_corporateEnglish corporate jargon

Explore

You can play with the various parameters with the API Explorer.

Responses

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.

JSON

A successful responses will contain the following data:

NameValue
errorfalse
insultThe generated string
argsA dictionary listing the parameters used to generate the output, including default values.

A failed response will have the following:

NameValue
errortrue
error_messageA brief message describing the reason for the error.

Methods

GET

/insult

Url: /api/insult

Generates an insult in plain text.

NameDescriptionDefault
langLanguageen
templateInsult templateNone
whoPerson to insult, changes the template to third person singular.None
pluralIf present (with who) changes the template to third person plural.None
Parameters

/insult.format

Url: /api/insult.html

Generates an insult in one of the supported formats.

NameDescriptionDefault
langLanguageen
templateInsult templateNone
whoPerson to insult, changes the template to third person singular.None
pluralIf present (with who) changes the template to third person plural.None
Parameters

/lang/insult.format

Url: /api/en/insult.html

Generates an insult in a fixed language.

NameDescriptionDefault
templateInsult templateNone
whoPerson to insult, changes the template to third person singular.None
pluralIf present (with who) changes the template to third person plural.None
Parameters

/adjective

Url: /api/adjective

Generates a single adjective in plain text.

NameDescriptionDefault
langLanguageen
Parameters

/adjective.format

Url: /api/adjective.html

Generates a single adjective in one of the supported formats.

NameDescriptionDefault
langLanguageen
Parameters

/lang/adjective.format

Url: /api/en/adjective.html

Generates a single adjective in a fixed language.

Template strings

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.

Entities

The following entities are provided to escape special characters:

Entity Expansion
&lt; <
&gt; >
&amp; &

Attributes

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.

Elements

The available elements depend on the language being used.

en

Normal words:

Special words:

en_corporate

Normal words:

Special words:

Examples

en:

You are as <adjective> as <article target=adj1> <adjective min=1 max=3 id=adj1> <amount> of <adjective min=1 max=3> <animal> <animal_part>

en_corporate:

We <adverb> <verb> <adjective min=1 max=3> <noun>