# Trainings

## Listing des formation

<mark style="color:green;">GET</mark> `https://api.cards-microlearning.com/v1/trainings`

Récupération d'une liste de formation.&#x20;

Cette liste peut être filtrée et est paginée.

**Entête (Headers)**

| Nom           | Valeur                                   |
| ------------- | ---------------------------------------- |
| Content-Type  | `application/json`                       |
| Authorization | `Bearer <token API>`                     |
| X-Tenant      | `<Identifiant de votre espace (Tenant)>` |

**Paramètre de l'url**

<table><thead><tr><th width="155">Nom</th><th width="137">Type</th><th width="289">Description</th><th width="166">Valeurs</th></tr></thead><tbody><tr><td><code>paginate</code></td><td>Nombre entier</td><td>Nombre d'élément dans la liste par page</td><td>Défaut : 100<br>Max : 500</td></tr><tr><td><code>filters</code></td><td>Tableau Json</td><td><p>Permet de filtrer sur des champs de la formation, comme : </p><ul><li>groups_id</li><li>groups_name</li><li>is_public</li><li>is_rating</li><li>status</li></ul><p>Chaque entrée dans le tableau correspond à un filtre "AND".<br>Chaque entrée doit avoir 2 clés : </p><ul><li>type</li><li>values</li></ul><p>La clé "values" peut être une chaine ou un tableau de valeurs (filtre "OR").<br>Format :<br>[<br>    {<br>        "type": "groups_name",<br>        "values":"RPS"<br>    },    </p><p>    {<br>        "type": "groups_name",<br>        "values":["vol","sin"]<br>    },     </p><p>    {<br>        "type": "groups_id",<br>        "values":"9c445054-c2f0-46c4-b784-ae6ea4c3ebbe"<br>    }<br>]<br></p></td><td></td></tr></tbody></table>

**Réponse**

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

<pre class="language-json"><code class="lang-json"><strong>{
</strong>  "data": [
    {
      "id": "string",
      "title": "string",
      "description": "string",
      "status": "string",
      "image": "string",
      "public_url": "string",
      "category": "string",
      "groups": [
        {
          "id": "string",
          "name": "string"
        }
      ],
      "date_start": "datetime",
      "date_end": "datetime",
      "created_at": "datetime",
      "updated_at": "datetime"
    },
    {
      (...)
    }
  ],
  "links": {
    "first": "https://api.cards-microlearning.com/v1/trainings?page=1",
    "last": "https://api.cards-microlearning.com/v1/trainings?page=7",
    "prev": null,
    "next": "https://api.cards-microlearning.com/v1/trainings?page=2"
  },
  "meta": {
    "current_page": int,
    "from": int,
    "last_page": int,
    "links": [
      {
        "url": null,
        "label": "&#x26;laquo; Previous",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/trainings?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": "https://api.cards-microlearning.com/v1/trainings?page=2",
        "label": "2",
        "active": false
      },
      {
        "url": null,
        "label": "...",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/trainings?page=6",
        "label": "6",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/trainings?page=7",
        "label": "Next &#x26;raquo;",
        "active": false
      }
    ],
    "path": "https://api.cards-microlearning.com/v1/trainings",
    "per_page": int,
    "to": int,
    "total": int
  }
}
</code></pre>

{% endtab %}

{% tab title="401" %}

```json
{
  "message": "Unauthenticated."
}
```

{% endtab %}

{% tab title="403" %}

```json
{
  "message": "Incorrect domain"
}
```

{% endtab %}
{% endtabs %}

## Récupérer une formation par son identifiant

<mark style="color:green;">GET</mark> `/trainings/<id_training>`

Récupérer les information d'une seule formation.

**Entête (Headers)**

| Name          | Value                                    |
| ------------- | ---------------------------------------- |
| Content-Type  | `application/json`                       |
| Authorization | `Bearer <token>`                         |
| X-Tenant      | `<Identifiant de votre espace (Tenant)>` |

**Réponse**

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

```json
{
  "data": {
    {
      "id": "string",
      "title": "string",
      "description": "string",
      "status": "string",
      "image": "string",
      "public_url": "string",
      "category": "string",
      "groups": [
        {
          "id": "string",
          "name": "string"
        }
      ],
      "date_start": "datetime",
      "date_end": "datetime",
      "created_at": "datetime",
      "updated_at": "datetime"
    }
  }
}
```

{% endtab %}

{% tab title="401" %}

```json
{
  "message": "Unauthenticated."
}
```

{% endtab %}

{% tab title="403" %}

```json
{
  "message": "Incorrect domain"
}
```

{% endtab %}

{% tab title="404" %}

```json
{
  "message": "Training doesn't exist",
  "type": "trainings"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docapi.cards-microlearning.com/ressources/trainings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
