The Thesaurus service 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.
Request url:
http://thesaurus.altervista.org/thesaurus/v1
Query Parameters
The following parameters are supported by the thesaurus Web service:
parameter | default | description |
key | * | String that uniquely identifies your application. The key is assigned by subscribing here |
word | * | (urlencoded string) |
language | * | cs_CZ, da_DK, de_CH, de_DE, en_US, el_GR, es_ES, fr_FR, hu_HU, it_IT, no_NO, pl_PL, pt_PT, ro_RO, ru_RU, sk_SK |
output | xml | xml or json |
callback | | javascript callback function (requires output=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 thesaurus 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=peace and language=en_US will return the following result:
xml output (test now: en_US, it_IT, fr_FR, es_ES)
<response>
<list><category>(noun)</category><synonyms>order|war (antonym)</synonyms></list>
<list><category>(noun)</category><synonyms>harmony|concord|concordance</synonyms></list>
<list><category>(noun)</category><synonyms>public security|security</synonyms></list>
<list><category>(noun)</category><synonyms>peace treaty|pacification|treaty|pact|accord</synonyms></list>
</response>
json output (test me!)
{"response":[{"list":{"category":"(noun)","synonyms":"order|war (antonym)"}},
{"list":{"category":"(noun)","synonyms":"harmony|concord|concordance"}},
{"list":{"category":"(noun)","synonyms":"public security|security"}},
{"list":{"category":"(noun)","synonyms":"peace treaty|pacification|treaty|pact|accord"}}]}
Error codes
The following error codes may be returned by the thesaurus Web service:
error code | description |
400 Bad Request | Wrong/Missing parameter |
403 Forbidden | You do not have permission to access this resource, or are over your rate limit |
404 Not Found | No match found for given word |
405 Method Not Allowed | Methods PUT, DELETE, POST... are rejected. Only GET is allowed |
|