getLexicon

Requête

Permet de récupérer les mots. La réponse retourne un array d'objets word.

Endpoint

[Domain]/academy/api/v1/Dictionary/getLexicon

Body

{
    "letter" : "a",
    "fromLanguage" : "km",
    "toLanguage" : "fr"
}
const endpoint = "[endpoint]";
const apiKey = "[myAPIKey]";

// Use the username and password to obtain data based on user rights
const username = "[username]"; // optionnel
const password = "[password]"; // optionnel

fetch(endpoint, {
    method: "POST",
    headers: {
        "Authorization": apiKey,
        "Content-Type": "application/json",
        "username ": username,
        "password ": password 
    },
    body: JSON.stringify({
        letter: "a",
        fromLanguage: "km",
        toLanguage: "fr"
    })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Erreur :", error));

Description des champs de la requête

Réponse

{
    "Dictionary": {
        "version": 7,
        "authorization": "all",
        "endValidity": "",
        "variety": "shiKomori ●",
        "entries": "213/213",
        "words": [
            {
                "id": 1065,
                "hasDefinition": false,
                "km": "-a",
                "fr": [
                    "à",
                    "de"
                ],
                "isShimaore": true,
                "isShimwali": true,
                "isShindzuani": true,
                "isShingazidja": true,
                "dialectSymbols": "●"
            },
            {
                "id": 1066,
                "hasDefinition": true,
                "km": "-a âiɓu",
                "fr": [
                    "immoral (d'-)",
                    "obscène (d'-)"
                ],
                "isShimaore": false,
                "isShimwali": false,
                "isShindzuani": true,
                "isShingazidja": true,
                "dialectSymbols": "▲  ◼"
            },
            {
                "id": 1101,
                "hasDefinition": false,
                "km": "aɓaɗan",
                "fr": [
                    "jamais"
                ],
                "isShimaore": true,
                "isShimwali": true,
                "isShindzuani": true,
                "isShingazidja": true,
                "dialectSymbols": "●"
            },
            {
                "id": 1103,
                "hasDefinition": true,
                "km": "aɓuɗu (u-)",
                "fr": [
                    "vénérer"
                ],
                "isShimaore": true,
                "isShimwali": true,
                "isShindzuani": true,
                "isShingazidja": true,
                "dialectSymbols": "●"
            }
        ]
    },
    ...
}

Avec une authorization de démo, cette requête ne renvoie qu'un nombre limité de mots. Le nombre de mots du dictionnaire est inscrits dans le champ entries. Vous pouvez vous servir des champs authorization et entries pour en informer l'utilisateur.

Description des champs de la réponse

Dernière mise à jour