Skip to content

Lexonomy API

rambousek edited this page Feb 4, 2021 · 11 revisions

Description of public APIs that can be used by external applications.

For some API calls, API key is needed. You can get your API key in User profile (One-Click Dictionary API key).

For local installations, change server name in URL.

Push data

Use this API to create dictionary and import entries. Examples and test at https://www.lexonomy.eu/push.api

Create new dictionary, with Lexonomy "One-Click Dictionary" template

{
  "email": "your Lexonomy user email",
  "apikey": "your Lexonomy API key",
  "command": "makeDict",
  "dictTitle": "dictionary title",
  "dictBlurb": "dictionary information",
  "poses": "array of PoS values",
  "labels": "array of entry labels"
}

example

{
  "email": "[email protected]",
  "apikey": "4HNA6VI6C9MROAENNYJQJPLL53HCAJMA",
  "command": "makeDict",
  "dictTitle": "My New Dictionary",
  "dictBlurb": "Yet another dictionary draft.",
  "poses": ["n", "v", "adj", "adv"],
  "labels": ["colloquial", "formal", "mostly plural", "Irish English", "vulgar"]
}
  • response: JSON encoded, in case of failure {"success": false}, in case of successful dictionary creation {"success": true, "dictID": "ID of new dictionary"}. You will need dictID for entry import.

Create new dictionary, with TEI-Lex0 template

{
  "email": "your Lexonomy user email",
  "apikey": "your Lexonomy API key",
  "command": "makeDict",
  "format": "teilex0",
  "dictTitle": "dictionary title",
  "dictBlurb": "dictionary information",
  "poses": "array of PoS values",
  "labels": "array of entry labels"
}
  • response: JSON encoded, in case of failure {"success": false}, in case of successful dictionary creation {"success": true, "dictID": "ID of new dictionary"}. You will need dictID for entry import.

List dictionaries

{
  "email": "your Lexonomy user email",
  "apikey": "your Lexonomy API key",
  "command": "listDicts",
}
  • response: JSON encoded, list of dictionaries accessible for given user
{
  "success": true,
  "entries": [
    {"id": "dictionary ID", "title": "dictionary title"}
  ]
}

Import entries into dictionary, general entry format

{
  "email": "your Lexonomy user email",
  "apikey": "your Lexonomy API key",
  "command": "createEntries",
  "dictID": "dictionary ID",
  "entryXmls": "array of XML strings"
}

example

{
  "email": "[email protected]",
  "apikey": "4HNA6VI6C9MROAENNYJQJPLL53HCAJMA",
  "command": "createEntries",
  "dictID": "4eve25a",
  "entryXmls": ["<entry><headword>Brno</headword></entry>", "<entry><headword>Prague</headword></entry>"]
}
  • response: JSON encoded, in case of failure {"success": false}, in case of successful entry import {"success": true}.

Import entries into dictionary, TEI-Lex0 entry format

{
  "email": "your Lexonomy user email",
  "apikey": "your Lexonomy API key",
  "command": "createEntries",
  "format": "teilex0",
  "dictID": "dictionary ID",
  "entryXmls": "array of XML strings"
}

example

{
  "email": "[email protected]",
  "apikey": "4HNA6VI6C9MROAENNYJQJPLL53HCAJMA",
  "command": "createEntries",
  "format": "teilex0",
  "dictID": "4eve25a",
  "entryXmls": ["<entry><form type='lemma'><orth>Earth</orth></form></entry>", "<entry><form type='lemma'><orth>Mars</orth></form></entry>"]
}
  • response: JSON encoded, in case of failure {"success": false}, in case of successful entry import {"success": true}.

Linking

OntoLex

Download dictionary data in OntoLex N-Triple format. For the moment, headword is used as set in the dictionary config, sense definitions are detected using most common entry elements.

{
  "email": "your Lexonomy user email",
  "apikey": "your Lexonomy API key"
}
  • response: text/plain, Ontolex N-Triple format

  • example response:

<https://www.lexonomy.eu/elexis-idiotikon#galsterig_26313> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/lemon/ontolex#LexicalEntry> .
<https://www.lexonomy.eu/elexis-idiotikon#galsterig_26313> <http://www.w3.org/2000/01/rdf-schema#label> "galsterig"@de .
<https://www.lexonomy.eu/elexis-idiotikon#galsterig_26313> <http://www.w3.org/ns/lemon/ontolex#sense> <https://www.lexonomy.eu/elexis-idiotikon#26313_1> .
<https://www.lexonomy.eu/elexis-idiotikon#26313_1> <http://www.w3.org/2004/02/skos/core#definition> "'ausser sich gebracht, seiner selbst nicht mehr mächtig'"@de .
<https://www.lexonomy.eu/elexis-idiotikon#galsterig_26313> <http://www.w3.org/ns/lemon/ontolex#sense> <https://www.lexonomy.eu/elexis-idiotikon#26313_2> .
<https://www.lexonomy.eu/elexis-idiotikon#26313_2> <http://www.w3.org/2004/02/skos/core#definition> "ausgelassen, mutwillig, übermütig lustig, von Mädchen"@de .