# getRecentWords

## Requête

Permet de récupérer les mots récents. La réponse retourne un array d'objets [word](https://connector-api.orelc.ac/objets/word).

#### Endpoint

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

#### Body

```json
{
    "size" : 3,
    "toLanguage" : "fr"
}
```

{% 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({
        "size" : 3,
        "toLanguage" : "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                    |
| ---------- | ------- | ----------------------------------- | ------------------------- |
| size       | integer | nombre de mots à retourner          | optionnelle (default : 3) |
| toLanguage | string  | La langue de traduction (ISO 639-1) | optionnelle (default fr)  |

## Réponse

```json
{
    "Dictionary": {
        "version": 1,
        "authorization": "demo",
        "endValidity": "",
        "variety": "shiKomori ●",
        "entries": "3/3",
        "words": [
            {
                "id": 8013,
                "hasDefinition": false,
                "km": "mongozi",
                "fr": [
                    "guide",
                    "meneur"
                ]
            },
            {
                "id": 8011,
                "hasDefinition": false,
                "km": "upotro",
                "fr": [
                    "gaucherie",
                    "maladresse"
                ]
            },
            {
                "id": 8010,
                "hasDefinition": false,
                "km": "Mngu",
                "fr": [
                    "Dieu"
                ]
            }
        ]
    },
    ...
}
```

Description des champs de la réponse

| Champ | Type  | Description                                    |
| ----- | ----- | ---------------------------------------------- |
| words | array | La liste d'objet word au format entrée/valeurs |
|       |       |                                                |
