Documentation API - Resto

Base URL : https://sahladelivery.com/resto/resto_api.php

POST /resto_api.php?action=login

Connexion d’un restaurant

Body JSON :

{
    "email": "resto@mail.com",
    "password": "motdepasse"
}

Réponse :

{
    "message": "Connexion réussie",
    "restaurant": {
        "id": 1,
        "nom": "Resto 1",
        "tel": "0555000000",
        "email": "resto@mail.com"
    }
}

GET /resto_api.php

Récupérer tous les restaurants

Réponse :

[
    {
        "id": 1,
        "nom": "Resto 1",
        "tel": "0555000000",
        "email": "resto@mail.com"
    },
    {
        "id": 2,
        "nom": "Resto 2",
        "tel": "0555001111",
        "email": "resto2@mail.com"
    }
]

GET /resto_api.php?id=1

Récupérer un restaurant par son id

Réponse :

{
    "id": 1,
    "nom": "Resto 1",
    "tel": "0555000000",
    "email": "resto@mail.com"
}

POST /resto_api.php

Créer un nouveau restaurant

Body JSON :

{
    "nom": "Resto 3",
    "tel": "0555002222",
    "email": "resto3@mail.com",
    "password": "secret"
}

Réponse :

{
    "message": "Restaurant créé avec succès",
    "id": 3
}

PUT /resto_api.php?id=3

Mettre à jour un restaurant existant

Body JSON :

{
    "nom": "Resto 3 Modifié",
    "tel": "0555003333"
}

Réponse :

{
    "message": "Restaurant mis à jour"
}

DELETE /resto_api.php?id=3

Supprimer un restaurant

Réponse :

{
    "message": "Restaurant supprimé"
}