The service script provides a simple RESTful API to get synonyms of a given word in the context of a specific language. An application can retrieve the synonyms by using a HTTP GET. The service script can return results either using xml or json format.

Query Parameters

The following parameters are supported by the sinonimi Web service:

word*(urlencoded string)
language*it_IT, fr_FR, en_US, es_ES, de_DE (other values may be allowed depending on dictionaries stored in directory 'dict')
outputxmlxml or json
*: mandatory parameter

Query parameters are preceded by a question mark ("?") and separated by ampersands ("&") and consist of the parameter name, an equals sign ("="), and a value.

Response content

The sinonimi Web service returns a sequence of elements list. Each list element contains a pair of elements: category and synonyms. The element synonyms contains a list of synonyms separated by the character |.
The detailed schema can be downloaded synonymResponse.xsd.

The query word=city and language=town will return the following result:

xml output (test me!)
<response> <list><category>(noun)</category><synonyms>metropolis|urban center|municipality</synonyms></list> <list><category>(noun)</category><synonyms>administrative district|administrative division|territorial division</synonyms></list> <list><category>(noun)</category><synonyms>metropolis|municipality</synonyms></list> </response>

json output (test me!)
{"response":[{"list":{"category":"(noun)","synonyms":"metropolis|urban center|municipality"}},{"list":{"category":"(noun)","synonyms":"administrative district|administrative division|territorial division"}},{"list":{"category":"(noun)","synonyms":"metropolis|municipality"}}]}

Error codes

The following error codes may be returned by the sinonimi Web service:

error codedescription
400 Bad RequestWrong/Missing parameter
404 Not FoundNo match found for given word
405 Method Not AllowedMethods PUT,DELETE,POST,... are rejected. Only GET is allowed

Get sinonimi at Fast, secure and Free Open Source software downloads
A live demo is available here, integrated in my web portal!