Slang Translation Using Urban Dictionary
URL
GET /search/<yourqueryhere>
You can search multiple words by comma separating queries.
/search/<query1>,<query2>
POST /search
You can also POST to /search for longer messages. Expects a JSON object with a single key, message, whose value is the array of messages to be "translated". Returns a JSON object with a single key of messages and an array containing objects representing each message. Only slang words are defined.
Success Response:
GET
{
"code": 0,
"error": null,
<query1>: {
"results": [
{"definition": "", "permalink": ""},
{"definition": "", "permalink": ""}
]
},
<query2>: {
"results": [
{"definition": "", "permalink": ""}
]
}
}
POST
{
"messages": [
{
"code": 0,
"error": null,
"message": <input sentence>
},
{
<slang word>: {
"results": [
{
"definition": <first definition>,
"example": <first example>,
"permalink": <first link>
},
{
"definition": <second definition>,
"example": <second example>,
"permalink": <second link>
}
]
},
"code": 0
"error" null
"message": <input sentence>
}
]
}
As a bonus, in the "message" field, if a word is identified as slang, it will be formatted to be highlighted if read into HTML, also with a class of highlight and an id of the identified word.
Error Response:
{
"code": 69,
"error": "something is wrong"
}
note: error text may actually differ
Sample Call:
http://slangslate.herokuapp.com/search/friend/ - GET Only
Notes: