Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API Reference

The dictionary server exposes a REST API under the /v1 prefix. A live instance is available at https://api.freedictionary.cn/.

GET /v1/wiktionary/{edition}/words/{word}

Returns the Wiktionary entries for the given word from the designated edition.

Path Parameters

  • edition: the code of the Wiktionary edition, e.g. en or zh. A route is registered for every WiktionaryData_* table found in the database; requesting an edition that is not supported returns 404 Not Found.

Query Parameters

Both parameters are optional and narrow the search when provided:

ParameterDescription
lang_codeThe language code of the word, e.g. en.
langThe localised language name of the word, e.g. 汉语.

If both are provided, both are applied as filters.

Examples

  • GET /v1/wiktionary/en/words/hello?lang_code=en — English-edition Wiktionary entry for the English word “hello”.
  • GET /v1/wiktionary/en/words/hallo?lang_code=de — English-edition Wiktionary entry for the German word “hallo”.
  • GET /v1/wiktionary/zh/words/你好?lang_code=zh — Chinese-edition Wiktionary entry for the Chinese word “你好”.

Response

  • 200 OK: a JSON array of entries for the word; an empty array means the word was not found in that Wiktionary. Each entry is the wrapped word-data object produced by the wiktionary-schema crate: the word data itself (see en::WordData and zh::WordData) plus a source object carrying provenance information — url (the Wiktionary page the data came from) and license, itself an object with name and url (defaults to CC BY-SA 4.0).

Error Responses

Error responses are JSON objects with the following shape:

{
  "status": 404,
  "message": "Unimplemented wiktionary edition: fr"
}
FieldTypeDescription
statusu16The HTTP status code of the error.
messageStringA human-readable error message.
StatusMeaning
404 Not FoundThe requested edition is not supported.
500 Internal Server ErrorStored data could not be decoded, or an unexpected database/server error occurred.
503 Service UnavailableThe database is temporarily unreachable; retrying the request may succeed.

GET /v1/wiktionary/editions

Returns a JSON array of all supported Wiktionary edition codes discovered in the database (e.g. ["en", "zh"]).

Response

  • 200 OK: a JSON array of edition code strings.

GET /v1/wiktionary/{edition}/words

Fuzzy word search. Returns a list of headwords matching the given pattern (e.g. som* matches “some”, “somebody”, “something”).

Note: This endpoint is reserved and not yet implemented. It currently returns 501 Not Implemented.

Query Parameters

ParameterRequiredDescription
qyesThe search pattern. Use * as a wildcard suffix for prefix matching (e.g. q=som*).
lang_codenoLanguage code filter.
langnoLocalised language name filter.
limitnoMaximum number of results to return.
offsetnoNumber of results to skip (for pagination).

Response (Planned)

  • 200 OK: a JSON array of matching headword strings.
  • 501 Not Implemented: the endpoint is not yet available.