The Fun With Strings service provides an entertaining web API about English words. You may ask the service to tell some word (in a random manner). Or ask for a Wikipaedia article about your personal word of the day. Finally, given a pair of first and last person names, get a joke about this person.
Authenticated users will be able to manage some internal stats of the service.
All API return the 200 HTTP response on sucess and one of 4xx/5xx on errors. Results are represented as json objects in the response body.
In a general case, an error is returned with the following json object in the body:
Fields:
- message: a string explaining an error.
Example:
GET /random
500 Internal Error
{
"message": "Application error."
}
A positive result is returned in a json object:
Fields:
- result: a string, or any other object as specified by the endpoint.
500 Internal Server Error
{
"message": "Application error."
}
Return a random word. Example:
GET /random
200 OK
{
"result": "hello"
}
Given the phrase, return a text of its article in the English Wikipedia (XML tree in a single string). Example:
GET /wikipedia/randomize
{
"result": "<root>'''Randomization''' is the process of
making something [[random]]; ...</root>"
}
Errors (example):
GET /wikipedia/qwepoiwerpoi
404 Not Found
{
"message": "No such wiki: qwepoiwerpoi"
}
Return a Chuck Norris joke for the given name pair. If either the last-name or both names are missing, they are replaced with the Norris and Chuck respectively. Example:
GET /joke/bill/gates
{
"result": "Hellen Keller's favorite color is bill gates."
}
Return the top n words submitted to the /wikipedia endpoint as an array of strings. Needs authentication. Example:
GET /stats/2
{
"result": [
"randomness",
"randomize"
]
}
Errors:
GET /stats/2
401 Unauthorized
{
"message": "Authentication required (fake)"
}
Clear the Wikipedia stats. Needs authentication.
POST /stats/reset
{
"result": "ok"
}
Errors:
POST /stats/reset
401 Unauthorized
{
"message": "Authentication required (fake)"
}