# Badges

## Listing des badges

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

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

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

**Entête (Headers)**

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

**Paramètre de l'url**

<table><thead><tr><th width="155">Nom</th><th width="124">Type</th><th width="315">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 paramètre du badge comme : </p><ul><li>status</li><li>option_teasing</li><li>notif</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>[</p><p>    {<br>        "type": "status",<br>        "values": ["draft","publish","expire"]<br>    }, </p><p>    {<br>        "type": "option_teasing",<br>        "values": 0<br>    },   <br>    {<br>        "type": "notif",<br>        "values": 1<br>    }<br>]<br></p></td><td></td></tr></tbody></table>

**Response**

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

```json
{
  "data": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "image": "url",
      "emoji": {
        "i": "emoji",
        "n": [
          "string",
        ],
        "r": "string",
        "t": "string",
        "u": "string"
      },
      "created_at": "datetime",
      "updated_at": "datetime"
    },
    {
      (...)
    }
  ],
  "links": {
    "first": "https://api.cards-microlearning.com/v1/badges?page=1",
    "last": "https://api.cards-microlearning.com/v1/badges?page=5",
    "prev": null,
    "next": "https://api.cards-microlearning.com/v1/badges?page=2"
  },
  "meta": {
    "current_page": int,
    "from": int,
    "last_page": int,
    "links": [
      {
        "url": null,
        "label": "&laquo; Previous",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/badges?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": "https://api.cards-microlearning.com/v1/badges?page=2",
        "label": "2",
        "active": false
      },
      {
        "url": null,
        "label": "...",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/badges?page=4",
        "label": "4",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/badges?page=5",
        "label": "Next &raquo;",
        "active": false
      }      
    ],
    "path": "https://api.cards-microlearning.com/v1/badges",
    "per_page": int,
    "to": int,
    "total": int
  }
}
```

{% endtab %}

{% tab title="401" %}

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

{% endtab %}

{% tab title="403" %}

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

{% endtab %}
{% endtabs %}

## Récupérer un badge par son identifiant

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

Récupérer les informations d'un seul badge.

**Entête (Headers)**

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

**Response**

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

```json
{
  "data": {
    "id": "string",
    "name": "string",
    "description": "string",
    "image": "url",
    "emoji": {
      "i": "emoji",
      "n": [
        "string",
      ],
      "r": "string",
      "t": "string",
      "u": "string"
    },
    "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": "Badge doesn't exist",
  "type": "badge"
}
```

{% endtab %}
{% endtabs %}

## Listing des utilisateurs ayant débloqué ce badge

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

Récupération d'une liste d'utilisateurs ayant débloqué un badge (via son identifiant).&#x20;

Cette liste est paginée.

**Entête (Headers)**

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

**Paramètre de l'url**

<table><thead><tr><th width="155">Nom</th><th width="124">Type</th><th width="281">Description</th><th width="187">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></tbody></table>

**Response**

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

```json
{
  "data": [
    {
      "id": "string",
      "firstname": "string",
      "lastname": "string",
      "email": "string",
      "role": "string",
      "company": "string",
      "phone": "string",
      "source": "string",
      "enable_ranking": bool,
      "lang": "string",
      "info_win": {
        "en": "string",
        "fr": "string"
      }
    },
    {
      (...)
    }
  ],
  "links": {
    "first": "https://api.cards-microlearning.com/v1/badges/<id_badge>/users?page=1",
    "last": "https://api.cards-microlearning.com/v1/badges/<id_badge>/users?page=5",
    "prev": null,
    "next": "https://api.cards-microlearning.com/v1/badges/<id_badge>/users?page=2"
  },
  "meta": {
    "current_page": int,
    "from": int,
    "last_page": int,
    "links": [
      {
        "url": null,
        "label": "&laquo; Previous",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/badges/<id_badge>/users?page=1",
        "label": "1",
        "active": true
      },
      {
        "url": "https://api.cards-microlearning.com/v1/badges/<id_badge>/users?page=2",
        "label": "2",
        "active": false
      },
      {
        "url": null,
        "label": "...",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/badges/<id_badge>/users?page=4",
        "label": "4",
        "active": false
      },
      {
        "url": "https://api.cards-microlearning.com/v1/badges/<id_badge>/users?page=5",
        "label": "Next &raquo;",
        "active": false
      }      
    ],
    "path": "https://api.cards-microlearning.com/v1/badges/<id_badge>/users",
    "per_page": int,
    "to": int,
    "total": int
  }
}
```

{% endtab %}

{% tab title="401" %}

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

{% endtab %}

{% tab title="403" %}

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

{% endtab %}

{% tab title="404" %}

```json
{
  "message": "Badge doesn't exist",
  "type": "badge"
}
```

{% 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/badges.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.
