# getRecentDefinitions

## Requête

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

#### Endpoint

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

#### 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

<pre class="language-json"><code class="lang-json">{
    "Dictionary": {
        "version": 1,
        "authorization": "demo",
        "endValidity": "",
        "variety": "shiKomori ●",
        "entries": "3/3",
        "words": [
            {
                "id": 1771,
                "hasDefinition": true,
                "km": "kaɓla",
                "fr": [
                    "avant"
                ]
            },
            {
                "id": 4256,
                "hasDefinition": true,
                "km": "kafe",
                "fr": [
                    "café"
                ]
            },
            {
                "id": 5441,
                "hasDefinition": true,
                "km": "kaka (u-)",
                "fr": [
                    "faire caca",
                    "déféquer"
                ]
            }
        ]
    },
    ...
<strong>}
</strong></code></pre>

Description des champs de la réponse

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