# translate

## Requête

Permet de traduire une entrée. La réponse retourne un array d'objets [word](https://connector-api.orelc.ac/objets/word).

#### Endpoint

```
[Domain]/academy/api/v1/Dictionary/translate
```

#### Body

```json
{
    "entry" : "uleza",
    "languages" : "fr"
}
```

#### Exemple

{% tabs %}
{% tab title="Javascript" %}

```javascript
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({
        "entry" : "uleza",
        "languages" : "fr"
    })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Erreur :", error));

```

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}

Description des champs de la requête

| Champ     | Type   | Description                                 | Valeur  |
| --------- | ------ | ------------------------------------------- | ------- |
| entry     | string | L'entrée à traduire                         | requise |
| languages | string | La langue de traduction au format ISO 639-2 | requise |
|           |        |                                             |         |

## Réponse

```json
{
    "Dictionary": {
        "version": 7,
        "authorization": "all",
        "endValidity": "",
        "variety": "shiKomori",
        "entries": "1/1",
        "word": {
            "leza (u-)": [
                "rendre ivre",
                "anesthésier"
            ],
            "isShimaore": false,
            "isShimwali": false,
            "isShindzuani": false,
            "isShingazidja": true,
            "dialectSymbols": "◼"
        }
    }
    ...
}
```

{% hint style="warning" %}
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.
{% endhint %}

Description des champs de la réponse

| Champ | Type   | Description |
| ----- | ------ | ----------- |
| word  | object | Objet word  |
|       |        |             |
