# Introduction

## MagicBot API

MagicBot vous permet d'utiliser les données de votre / vos serveur(s) grâce à son API !&#x20;

* Version - 1.0.0
* Jusqu'à 240 requêtes par heure
* Protocole : `https`

:warning: <mark style="color:red;">**En utilisant notre API, vous acceptez que nous puissions utiliser votre adresse IP pour limiter vos requêtes. Dans le cas contraire, veuillez ne pas utiliser notre service !**</mark>

## Comment accéder à l'API ?

Vous devez acquérir une clé d'api :

## Endpoints

Toutes les requêtes possibles sont détaillées ici : [Endpoints](#endpoints)&#x20;

## Support

Des questions ? Besoin d'aide ? Rejoignez notre Discord et nous serons heureux de pouvoir vous aider : [MagicBot serveur Discord](https://discord.gg/SXJnFEVvd3)


# Authentification

{% hint style="info" %}
Le token est disponible pour tous les utilisateurs, il suffit d'en faire la demande comme indiqué ci-dessous !
{% endhint %}

## Comment obtenir sa clé d'API

* Vos requêtes à l'API sont authentifiées à l'aide de votre clé d'API. Toute demande qui n'inclut pas une clé API renverra une erreur.
* Chaque clé d'API permet d'avoir accès à certaines données d'un serveur précis. Vous devez en être le propriétaire pour en faire la demande.
* Pour obtenir une clé d'API, rendez-vous sur le serveur support et ouvrez un ticket : [MagicBot serveur Discord](https://discord.gg/SXJnFEVvd3)

{% hint style="success" %}
La clé d'API a été récupérée avec succès !&#x20;
{% endhint %}

> **Header de votre requête**
>
> * Vous devez définir votre clé d'API comme **Token** dans le header de chacune de vos requêtes.
> * N'oubliez pas le terme **Bearer** devant votre clé d'API.

## Exemple

#### NodeJS / node-fetch

```javascript
const fetch = require("node-fetch")

fetch('https://api.magic-bot.ovh/v1/premium', {
  headers: { 'Token': 'Bearer votre_token' }
  })
  .then(res => res.json())
  .then(json => console.log(json));
```


# Erreurs

Les erreurs les plus communes sont listées ci-dessous :

| Statut | Message             |
| ------ | ------------------- |
| 200    | OK                  |
| 401    | Non autorisé        |
| 400    | Requête incorrecte  |
| 404    | Requête inexistante |

* "*<mark style="color:red;">This IP has been banned from using the service</mark>*" : Vous n'êtes plus autoriser à utiliser notre API car vous avez enfreint son utilisation.
* &#x20;"*<mark style="color:red;">No token header provided</mark>*" : Vous n'avez pas fourni la clé d'API ou le header est incorrect.
* "*<mark style="color:red;">Invalid token</mark>*" : La clé d'API n'est pas valide pour le serveur demandé.


# Endpoints

Voici toutes les requêtes possibles grâce à notre API :

## Profil des joueurs

Cette méthode permet d'avoir accès aux données liées aux joueurs de votre serveur.

{% content-ref url="/pages/24wByHhPmBeoYwHKrkG2" %}
[Profil des joueurs](/endpoints/endpoints/profil-des-joueurs)
{% endcontent-ref %}

## Inventaire des joueurs

Cette méthode permet d'avoir accès aux données liées à l'inventaire des joueurs de votre serveur.

{% content-ref url="/pages/pa3Z7TfKZZ6tVEuxVcxR" %}
[Inventaire des joueurs](/endpoints/endpoints/inventaire-des-joueurs)
{% endcontent-ref %}

## Métiers

Cette méthode permet d'avoir accès aux métiers créés sur votre serveur.

{% content-ref url="/pages/u9uIN4ZBse8iMPTQsYVI" %}
[Métiers](/endpoints/endpoints/metiers)
{% endcontent-ref %}

## Boutique

Cette méthode permet d'avoir accès à la boutique de votre serveur.

{% content-ref url="/pages/3nEmwVcv9kg22ywLYXnj" %}
[Boutique](/endpoints/endpoints/boutique)
{% endcontent-ref %}

## Points des Maisons

Cette méthode permet d'avoir accès aux points de chaque maison de votre serveur.

{% content-ref url="/pages/OCUGMYHWFbxFqk29JYWT" %}
[Points des Maisons](/endpoints/endpoints/points-des-maisons)
{% endcontent-ref %}

## Premium

Cette méthode permet d'avoir le statut du premium sur votre serveur.

{% content-ref url="/pages/DKuAz5v5wOkzHSDOrBWi" %}
[Premium](/endpoints/endpoints/premium)
{% endcontent-ref %}


# Profil des joueurs

## Obtenir des informations sur la méthode

## Afficher la liste des méthodes disponibles et leur description  / syntaxe respective.

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/players`

#### Path Parameters

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key |

{% tabs %}
{% tab title="200 Page affichée avec succès" %}

{% endtab %}

{% tab title="401 Permission refusée" %}

{% endtab %}
{% endtabs %}

## Obtenir les profiles de tous les membres de votre serveur

## Afficher les profiles de tous les joueurs de votre serveur.

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/players/:guildId`

#### Path Parameters

| Name                                            | Type   | Description                        |
| ----------------------------------------------- | ------ | ---------------------------------- |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                       |

{% tabs %}
{% tab title="200: OK Liste affichée avec succès !" %}

```json
{
   "results": [
      {
         "user_id": "xxxxxxxxxxxxxxxx",
         "guild_id": "xxxxxxxxxxxxxxxx"
         ...
      }
   ],
   "count": 1,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found Aucun membre n'a été trouvé pour ce serveur" %}

```javascript
{
   "error": "No player found on this server",
   "status": 404
}
```

{% endtab %}
{% endtabs %}

## Obtenir les profiles d'un membre de votre serveur

## Afficher tous les profiles d'un membre de votre serveur.&#x20;

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/players/:guildId/:userId`

#### Path Parameters

| Name                                            | Type   | Description                         |
| ----------------------------------------------- | ------ | ----------------------------------- |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get  |
| userId<mark style="color:red;">\*</mark>        | String | The identifier of the member to get |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                        |

{% tabs %}
{% tab title="200: OK Liste affichée avec succès !" %}

```javascript
{
   "results": [
      {
         "user_id": "xxxxxxxxxxxxxxxx",
         "guild_id": "xxxxxxxxxxxxxxxx"
         ...
      }
   ],
   "count": 1,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found Le membre n'a pas été trouvé" %}

```javascript
{
   "error": "Player not found",
   "status": 404
}
```

{% endtab %}
{% endtabs %}


# Inventaire des joueurs

## Obtenir des informations sur la méthode

## Afficher la liste des méthodes disponibles et leur description  / syntaxe respective.

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/inventory`

#### Path Parameters

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key |

{% tabs %}
{% tab title="200: OK Page affichée avec succès" %}

{% endtab %}

{% tab title="401: Unauthorized Permission refusée" %}

{% endtab %}
{% endtabs %}

## Obtenir l'inventaire de tous les membres de votre serveur

## Afficher l'inventaire de tous les membres de votre serveur.

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/inventory/:guildId`

#### Path Parameters

| Name                                            | Type   | Description                        |
| ----------------------------------------------- | ------ | ---------------------------------- |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                       |

{% tabs %}
{% tab title="200: OK Liste affichée avec succès !" %}

```javascript
{
   "results": [
      {
         "user_id": "xxxxxxxxxxxxxxxx",
         "guild_id": "xxxxxxxxxxxxxxxx"
         ...
      }
   ],
   "count": 1,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found Aucun inventaire n'a été trouvé pour ce serveur" %}

```javascript
{
   "error": "No player inventory found on this server",
   "status": 404
}
```

{% endtab %}
{% endtabs %}

## Obtenir l'inventaire d'un membre de votre serveur

## Afficher l'inventaire d'un membre de votre serveur.&#x20;

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/inventory/:guildId/user/:userId`

#### Path Parameters

| Name                                            | Type   | Description                         |
| ----------------------------------------------- | ------ | ----------------------------------- |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get  |
| userId<mark style="color:red;">\*</mark>        | String | The identifier of the member to get |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                        |

{% tabs %}
{% tab title="200: OK Liste affichée avec succès !" %}

```javascript
{
   "results": [
      {
         "user_id": "xxxxxxxxxxxxxxxx",
         "guild_id": "xxxxxxxxxxxxxxxx"
         ...
      }
   ],
   "count": 1,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found L'inventaire du membre n'a pas été trouvé" %}

```javascript
{
   "error": "User inventory not found",
   "status": 404
}
```

{% endtab %}
{% endtabs %}

## Obtenir l'inventaire d'un joueur de votre serveur

## Afficher l'inventaire d'un joueur de votre serveur.&#x20;

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/inventory/:guildId/player/:playerId`

#### Path Parameters

| Name                                            | Type   | Description                         |
| ----------------------------------------------- | ------ | ----------------------------------- |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get  |
| playerId<mark style="color:red;">\*</mark>      | String | The identifier of the player to get |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                        |

{% tabs %}
{% tab title="200: OK Liste affichée avec succès !" %}

```javascript
{
   "results": [
      {
         "user_id": "xxxxxxxxxxxxxxxx",
         "guild_id": "xxxxxxxxxxxxxxxx"
         ...
      }
   ],
   "count": 1,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found L'inventaire du joueur n'a pas été trouvé" %}

```javascript
{
   "error": "Player inventory not found",
   "status": 404
}
```

{% endtab %}
{% endtabs %}


# Métiers

## Obtenir des informations sur la méthode

## Afficher la liste des méthodes disponibles et leur description  / syntaxe respective.

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/jobs`

#### Path Parameters

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key |

{% tabs %}
{% tab title="200: OK Page affichée avec succès" %}

{% endtab %}

{% tab title="401: Unauthorized Permission refusée" %}

{% endtab %}
{% endtabs %}

## Obtenir tous les métiers de votre serveur

## Afficher la liste de tous les métiers de votre serveur

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/jobs/:guildId`

#### Path Parameters

| Name                                            | Type   | Description                        |
| ----------------------------------------------- | ------ | ---------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                       |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get |

{% tabs %}
{% tab title="200: OK Liste affichée avec succès !" %}

```javascript
{
   "results": [
      {
         "guild_id": "xxxxxxxxxxxxxxxx"
         ...
      }
   ],
   "count": 1,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found Aucun métier n'a été trouvé pour ce serveur" %}

```javascript
{
   "error": "No job found on this server",
   "status": 404
}
```

{% endtab %}
{% endtabs %}


# Boutique

## Obtenir des informations sur la méthode

## Afficher la liste des méthodes disponibles et leur description  / syntaxe respective.

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/shop`

#### Path Parameters

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key |

{% tabs %}
{% tab title="200: OK Page affichée avec succès" %}

{% endtab %}

{% tab title="401: Unauthorized Permission refusée" %}

{% endtab %}
{% endtabs %}

## Obtenir la boutique de votre serveur

## Afficher la liste de la boutique de votre serveur

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/shop/:guildId`

#### Path Parameters

| Name                                            | Type   | Description                        |
| ----------------------------------------------- | ------ | ---------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                       |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get |

{% tabs %}
{% tab title="200: OK Liste affichée avec succès !" %}

```javascript
{
   "results": [
      {
         "guild_id": "xxxxxxxxxxxxxxxx"
         ...
      }
   ],
   "count": 1,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found Aucune boutique n'a été trouvée pour ce serveur" %}

```javascript
{
   "error": "No shop found on this server",
   "status": 404
}
```

{% endtab %}
{% endtabs %}


# Points des Maisons

## Obtenir des informations sur la méthode

## Afficher la liste des méthodes disponibles et leur description  / syntaxe respective.

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/points`

#### Path Parameters

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key |

{% tabs %}
{% tab title="200: OK Page affichée avec succès" %}

{% endtab %}

{% tab title="401: Unauthorized Permission refusée" %}

{% endtab %}
{% endtabs %}

## Obtenir les points de chaque maison de votre serveur

## Afficher les points de chaque maison de votre serveur

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/points/:guildId`

#### Path Parameters

| Name                                            | Type   | Description                        |
| ----------------------------------------------- | ------ | ---------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                       |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get |

{% tabs %}
{% tab title="200: OK Points affichés avec succès !" %}

```javascript
{
   "gryffindor": 10,
   "slytherin": 10,
   "ravenclaw": 10,
   "hufflepuff": 10,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found Aucun point n'a été trouvé pour ce serveur" %}

```javascript
{
   "error": "No house points found on this serve",
   "status": 404
}
```

{% endtab %}
{% endtabs %}


# Premium

## Obtenir des informations sur la méthode

## Afficher la liste des méthodes disponibles et leur description  / syntaxe respective.

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/premium`

#### Path Parameters

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key |

{% tabs %}
{% tab title="200: OK Page affichée avec succès" %}

{% endtab %}

{% tab title="401: Unauthorized Permission refusée" %}

{% endtab %}
{% endtabs %}

## Obtenir le statut du premium de votre serveur

## Afficher le statut du premium de votre serveur

<mark style="color:blue;">`GET`</mark> `https://api.magic-bot.ovh/v1/premium/:guildId`

#### Path Parameters

| Name                                            | Type   | Description                        |
| ----------------------------------------------- | ------ | ---------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Your api key                       |
| guildId<mark style="color:red;">\*</mark>       | String | The identifier of the guild to get |

{% tabs %}
{% tab title="200: OK Liste affichée avec succès !" %}

```javascript
{
   "guildId": "829070822629965864",
   "premium": <true || false>,
   "status": 200
}
```

{% endtab %}

{% tab title="404: Not Found Aucun premium n'a été trouvé pour ce serveur" %}

```javascript
{
   "guildId": "829070822629965864",
   "premium": false,
   "status": 404
}
```

{% endtab %}
{% endtabs %}


