Dictionary API and Translation Memory API description. This page aims to describe Programming Interface to Glosbe Dictionary and Translation Memory data.

Important: currently API is in alpha stage and both input and output formats may change.

Overview

Glosbe offers programmatic access to dictionary translations (with phrase meanings and phrase meta informations) and to translation memories as well.

Currently API is in it's alpha version and everything described on this page is a subject to change.

Implementation

API is based on web interface. Standard way to run Glosbe API function is:

http://glosbe.com/gapi/{function-name}[?[{function-parameter1}={value}[&{function-parameter2}={value}[&{function-parameter3}={value}...]]]]

where:

  • /gapi/ is common prefix to all API functions
  • function-name indicate function to be invoked
  • order of parameters is free
  • parameters should be encoded (find more at http://en.wikipedia.org/wiki/Query_string page)

API works on subdomains (like de.glosbe.com, fr.glosbe.com). Subdomains would be used for localization of output messages: de. would be German, fr. French, en. English etc. Currently this feature is not used, as there is no localized messages. Glosbe.com uses English.

Output format

Currenlty we support three output formats.

  • json: set format paramter to 'json'.
  • jsonp: set format to 'json' and set callback parameter.
  • xml: set format to 'xml'

The &pretty=true parameter can be used to display returned string in more readable format.

Type format codes in lowercases while putting them in parameters.

If there is some format you think we should support contact us.

Please see examples to learn exact format used.

Language codes

We use ISO 639-3 language codes for indicating language. If you don't know your language code you can check it on http://en.wikipedia.org/wiki/List_of_ISO_639-3_codes page.

Examples of valid 3 letters language codes: 'eng' - English, 'fra' - French, 'deu' - German.

API should understand two letter codes as well ('en' - English, 'de' - German etc.) but it's recommended to use three letter ISO 693-3 codes.

API Version

The newest API version can always be found at prefix:

http://glosbe.com/gapi/

Current API version can be found at /gapi_v0_1/.

http://glosbe.com/gapi_v0_1/

Functions

translate

Gives access to mono and bilingual dictionaries

Parameters
  • from - (required) language of phrase to translate, values: ISO 693-3 three letter language code, no default, beware: if language is invalid you'll get server 500 error code in return
  • dest - (required) destination language, values: ISO 693-3 three letter language code, no default
  • phrase - (required) phrase to be translated, values: arbitrary text, no default, case sensitive
  • tm - whether to include examples (make translation memories search), values: 'true' or 'false', default: 'false'
  • format - described elsewhere
  • callback - described elsewhere
Example

tm

Gives access to translation memory

Parameters
  • from - (required) language of phrase to translate, values: ISO 693-3 three letter language code, no default
  • dest - (required) destination language, values: ISO 693-3 three letter language code, no default
  • phrase - (required) phrase to be searched in existing translated sentences, values: arbitrary text, no default
  • page - page of results to be displayed, values: counted from 1, positive number lower than arbitrary limit - you cannot see results above 200 item, default: 1;
  • pageSize - size of the result page, values: positive number lower or equal 30, default: 30
  • format - described elsewhere
  • callback - described elsewhere
Example

addTranslation

You can use it to enrich Glosbe data. To use addTranslation you need API key, so that we can connect your contribution with your account. You can get several API keys and use them to put data from several sources – for example if you have several dictionaries to import or several websites using our API.

To get API key login and go to your profile page (click your login at top-right corner). Goto "Mass contribution tab" and click "request new api key".

addTranslation must be invoked in POST request

Parameters
  • lang1 - (required) language of phrase1 to translate, values: ISO 693-3 three letter language code, no default
  • lang2 - (required) language of phrase2 to translate, values: ISO 693-3 three letter language code, no default
  • phrase1 - (required) phrase in language lang1, no default
  • phrase2 - (required) phrase in language lang2, no default
  • meaning1 - meaning of phrase1 in language lang1, no default
  • meaning2 - meaning of phrase2 in language lang2, no default
  • apiKey - (required) described above
  • format - described elsewhere
  • callback - described elsewhere
Example
  • add translation of Polish "but" to English "shoe" using curl (api key is hidden):
curl -d "lang1=pol&lang2=eng&phrase1=but&phrase2=shoe2&format=json&apiKey=YOUR_32_LETTERS_API_KEY" http://glosbe.com/gapi/addTranslation

Terms of Service

API is free to use, regarding indicated data source license. There is a limit of call that may be done from one IP in fixed period of time, to prevent from abuse. The limit is not strict, there is heuristics that guesses whether queries comes from robot or human. If there are too many queries or they look non-human – IP gets blocked. If you are a developer and such case happens: please contact us.

Glosbe attribution

If you use our API please add information about the API provider. Please add a link to Glosbe homepage.

Commercial usage

Some of data we have in Glosbe and we provide through API excludes usage for commercial projects. Please do not ask me what does it mean as I'm not a lawyer. There is information about an author attached to each data piece you receive. Theoretically you should check the license and then determine whether you can show this data to your user or not...

Share

If you're using or planning to use our API: why don't you contact us? It's always nice to hear that someone is using our service. Consider also sharing your job as an OpenSource project. It's good to share.