MENU navbar-image

Introduction

API Werise, le back-office de BabiMap : commerces, articles, adresses et commandes.

Choisissez une section à gauche. Les exemples de code s'affichent à droite, en bash ou en JavaScript.

Base de données

Le schéma complet — chaque table, chaque champ, les types, les clés et les relations — est consultable ici :

→ Volet Base de données

Il est lu en direct sur la base, donc toujours à jour.

Authentification

Ajoutez l'en-tête Authorization avec la valeur "Bearer {YOUR_AUTH_KEY}".

Les routes qui l'exigent portent le badge requires authentication.

Le jeton s'obtient à la connexion, via Laravel Sanctum.

Administration

Connexion au back-office Werise.

Connexion

Vérifie les identifiants et renvoie un couple de jetons. Le jeton d'accès est volontairement court : le client le rafraîchit avec refreshToken.

Exemple de requête:
curl --request POST \
    "http://172.20.10.4:8000/api/admin/connexion" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"admin@werise.com\",
    \"password\": \"motdepasse\"
}"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/connexion"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "admin@werise.com",
    "password": "motdepasse"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Exemple de réponse (200):


{
    "token": "…",
    "refreshToken": "…",
    "expiresIn": 900,
    "expiresAt": "2026-08-02T12:15:00+00:00",
    "admin": {
        "id": 1,
        "email": "admin@werise.com"
    }
}
 

Exemple de réponse (401):


{
    "message": "Identifiants incorrects."
}
 

Exemple de réponse (429):


{
    "message": "Trop de tentatives. Réessaie dans 60 secondes."
}
 

Requête      

POST api/admin/connexion

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Paramètres du corps

email   string     

L'adresse email de l'administrateur. Example: admin@werise.com

password   string     

Le mot de passe. Example: motdepasse

Rafraîchir le jeton

Échange un jeton de rafraîchissement contre un nouveau couple de jetons. L'ancien jeton de rafraîchissement est invalidé au passage.

Exemple de requête:
curl --request POST \
    "http://172.20.10.4:8000/api/admin/rafraichir" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"refreshToken\": \"architecto\"
}"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/rafraichir"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "refreshToken": "architecto"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Exemple de réponse (200):


{
    "token": "…",
    "refreshToken": "…",
    "expiresIn": 900,
    "expiresAt": "2026-08-02T12:30:00+00:00",
    "admin": {
        "id": 1,
        "email": "admin@werise.com"
    }
}
 

Exemple de réponse (401):


{
    "message": "Jeton de rafraîchissement invalide ou expiré."
}
 

Requête      

POST api/admin/rafraichir

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Paramètres du corps

refreshToken   string     

Le jeton de rafraîchissement reçu à la connexion. Example: architecto

Administrateur connecté

Renvoie le compte associé au jeton d'accès.

Exemple de requête:
curl --request GET \
    --get "http://172.20.10.4:8000/api/admin/moi" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/moi"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Exemple de réponse (200):


{
    "admin": {
        "id": 1,
        "email": "admin@werise.com"
    }
}
 

Exemple de réponse (401):


{
    "message": "Jeton invalide ou expiré.",
    "expire": true
}
 

Requête      

GET api/admin/moi

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Déconnexion

Invalide les deux jetons du compte.

Exemple de requête:
curl --request POST \
    "http://172.20.10.4:8000/api/admin/deconnexion" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/deconnexion"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Exemple de réponse (200):


{
    "message": "Déconnecté."
}
 

Requête      

POST api/admin/deconnexion

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Vue d'ensemble

Indicateurs du tableau de bord : cartes de tête, volumes de contenu, courbe des inscriptions, répartition par catégorie, abonnements et paiements, file de modération.

Exemple de requête:
curl --request GET \
    --get "http://172.20.10.4:8000/api/admin/vue-ensemble?mois=12&debut=2026-01&fin=2026-08" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/vue-ensemble"
);

const params = {
    "mois": "12",
    "debut": "2026-01",
    "fin": "2026-08",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Exemple de réponse (200, succès):


{
    "cartes": {
        "commercantsActifs": {
            "valeur": 12,
            "evolution": "+3 ce mois",
            "positif": true
        }
    },
    "contenu": {
        "articles": {
            "valeur": 2
        }
    },
    "inscriptions": [
        {
            "mois": "Juil",
            "periode": "2026-07",
            "commercants": 4,
            "utilisateurs": 9
        }
    ],
    "categories": [
        {
            "nom": "Restauration",
            "total": 3,
            "pourcentage": 25
        }
    ],
    "abonnements": {
        "actifs": 2,
        "encaisseMois": 55000
    },
    "moderation": {
        "total": 0,
        "elements": [],
        "source": false
    }
}
 

Requête      

GET api/admin/vue-ensemble

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Paramètres de requête

mois   integer  optional    

Profondeur de la courbe d'inscriptions, entre 3 et 36. Example: 12

debut   string  optional    

Premier mois de la courbe au format AAAA-MM. Prend le pas sur mois. Example: 2026-01

fin   string  optional    

Dernier mois de la courbe au format AAAA-MM. Par défaut le mois courant. Example: 2026-08

Carte des commerces

Renvoie les commerces géolocalisés, les catégories servant de filtres et les compteurs de tête. Un commerce sans coordonnées est compté mais pas renvoyé dans la liste : il n'a rien à faire sur une carte.

Exemple de requête:
curl --request GET \
    --get "http://172.20.10.4:8000/api/admin/carte" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/carte"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Exemple de réponse (200, succès):


{
    "centre": [
        5.33,
        -4.02
    ],
    "zoom": 13,
    "stats": {
        "total": 8,
        "cartographies": 5,
        "actifs": 8,
        "inactifs": 0,
        "sansCoordonnees": 3
    },
    "categories": [
        {
            "id": 1,
            "nom": "Restauration",
            "couleur": "oklch(0.68 0.12 65)",
            "commerces": 2
        }
    ],
    "commerces": [
        {
            "id": 4,
            "nom": "ete",
            "adresse": "Cocody",
            "telephone": "0700000000",
            "lat": 5.39,
            "lng": -3.98,
            "actif": true,
            "categories": [
                1
            ],
            "couleur": "oklch(0.68 0.12 65)",
            "categoriePrincipale": "Restauration",
            "categoriesNoms": [
                "Restauration"
            ],
            "photo": null,
            "note": 4.3,
            "avis": 12,
            "abonnes": 48,
            "likes": 130,
            "articles": 9,
            "dernierAvis": {
                "texte": "Très bon accueil.",
                "note": 5,
                "date": "2026-07-28T10:12:00Z",
                "auteur": "Awa K."
            }
        }
    ]
}
 

Requête      

GET api/admin/carte

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Détail d'un commerce

Toutes les informations que la base contient sur un commerce : fiche, propriétaire, catégories, photos, horaires, réseaux, statistiques et dernières activités.

Exemple de requête:
curl --request GET \
    --get "http://172.20.10.4:8000/api/admin/commerces/4" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/commerces/4"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Exemple de réponse (401):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "Jeton absent."
}
 

Exemple de réponse (404):


{
    "message": "Commerce introuvable."
}
 

Requête      

GET api/admin/commerces/{id}

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Paramètres d'URL

id   integer     

Identifiant du commerce. Example: 4

Liste des paiements

Tous les encaissements d'abonnement, avec le client, la formule et la période couverte. Filtrable et paginé.

Exemple de requête:
curl --request GET \
    --get "http://172.20.10.4:8000/api/admin/paiements?recherche=Vigivot&statut=paye&moyen=wave&debut=2026-07-01&fin=2026-08-31&page=1&parPage=20" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/paiements"
);

const params = {
    "recherche": "Vigivot",
    "statut": "paye",
    "moyen": "wave",
    "debut": "2026-07-01",
    "fin": "2026-08-31",
    "page": "1",
    "parPage": "20",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Exemple de réponse (200, succès):


{
    "resume": {
        "nombre": 2,
        "montant": 55000,
        "devise": "FCFA"
    },
    "paiements": [
        {
            "id": "…",
            "montant": 50000,
            "client": "Vigivot Eddy",
            "formule": "Prenium",
            "statut": "paye"
        }
    ],
    "pagination": {
        "page": 1,
        "parPage": 20,
        "total": 2,
        "pages": 1
    },
    "filtres": {
        "statuts": [
            "paye"
        ],
        "moyens": [
            "wave"
        ]
    }
}
 

Requête      

GET api/admin/paiements

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Paramètres de requête

recherche   string  optional    

Filtre sur le client, l'email ou la formule. Example: Vigivot

statut   string  optional    

Filtre sur l'état du paiement. Example: paye

moyen   string  optional    

Filtre sur le moyen de paiement. Example: wave

debut   string  optional    

Date de début au format AAAA-MM-JJ. Example: 2026-07-01

fin   string  optional    

Date de fin incluse au format AAAA-MM-JJ. Example: 2026-08-31

page   integer  optional    

Numéro de page, à partir de 1. Example: 1

parPage   integer  optional    

Lignes par page, 100 au maximum. Example: 20

Liste des commerçants

Tous les commerces inscrits, avec leur responsable et leur état. Il n'y a pas de validation à faire : un commerce existe dès son inscription, l'administration peut seulement le bloquer.

Exemple de requête:
curl --request GET \
    --get "http://172.20.10.4:8000/api/admin/commercants?recherche=ali&etat=bloque&page=1&parPage=20" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/commercants"
);

const params = {
    "recherche": "ali",
    "etat": "bloque",
    "page": "1",
    "parPage": "20",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Exemple de réponse (200, succès):


{
    "resume": {
        "total": 8,
        "actifs": 8,
        "bloques": 0
    },
    "commercants": [
        {
            "id": 5,
            "nom": "CHez Ali",
            "actif": true
        }
    ],
    "pagination": {
        "page": 1,
        "parPage": 20,
        "total": 8,
        "pages": 1
    }
}
 

Requête      

GET api/admin/commercants

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Paramètres de requête

recherche   string  optional    

Filtre sur le commerce, le responsable ou l'email. Example: ali

etat   string  optional    

actif ou bloque. Example: bloque

page   integer  optional    

Numéro de page, à partir de 1. Example: 1

parPage   integer  optional    

Lignes par page, 100 au maximum. Example: 20

Bloquer ou débloquer un commerce

Bascule is_active. Un commerce bloqué disparaît de l'app mobile ; aucune donnée n'est supprimée, l'opération est réversible.

Exemple de requête:
curl --request PATCH \
    "http://172.20.10.4:8000/api/admin/commerces/5/blocage" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"bloque\": true
}"
const url = new URL(
    "http://172.20.10.4:8000/api/admin/commerces/5/blocage"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "bloque": true
};

fetch(url, {
    method: "PATCH",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Exemple de réponse (200):


{
    "id": 5,
    "nom": "CHez Ali",
    "actif": false,
    "message": "Commerce bloqué."
}
 

Exemple de réponse (404):


{
    "message": "Commerce introuvable."
}
 

Requête      

PATCH api/admin/commerces/{id}/blocage

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Paramètres d'URL

id   integer     

Identifiant du commerce. Example: 5

Paramètres du corps

bloque   boolean     

true pour bloquer, false pour réactiver. Example: true

Système

État de l'API Vérifie que l'API Werise répond. Utile pour les sondes de disponibilité.

Exemple de requête:
curl --request GET \
    --get "http://172.20.10.4:8000/api/sante" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/sante"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Exemple de réponse (200):


{
    "statut": "ok",
    "service": "werise-api"
}
 

Requête      

GET api/sante

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json

Utilisateurs

Utilisateur connecté Retourne l'utilisateur associé au jeton Sanctum envoyé dans l'en-tête `Authorization`.

Exemple de requête:
curl --request GET \
    --get "http://172.20.10.4:8000/api/user" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "http://172.20.10.4:8000/api/user"
);

const headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};


fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Exemple de réponse (401):

Show headers
cache-control: no-cache, private
content-type: application/json
vary: Origin
 

{
    "message": "Unauthenticated."
}
 

Requête      

GET api/user

En-têtes

Content-Type        

Example: application/json

Accept        

Example: application/json