Base URL:
https://sahladelivery.com/les_plats/api_plats.php
This API allows you to manage restaurant dishes (plats).
Supported operations:
/les_plats/api_plats.php
Returns all active plats.
[
{
"id": 1,
"nom": "Pizza",
"prix": 1200,
"id_resto": 2,
"img": "171234234_pizza.jpg",
"actif": 1
}
]
/les_plats/api_plats.php?id=1
{
"id": 1,
"nom": "Pizza",
"prix": 1200,
"id_resto": 2,
"img": "pizza.jpg"
}
/les_plats/api_plats.php?id_resto=2
This endpoint allows you to retrieve all active plats that belong to a specific restaurant using id_resto.
| Parameter | Type | Required | Description |
|---|---|---|---|
| id_resto | number | Yes | ID of the restaurant |
GET /les_plats/api_plats.php?id_resto=2
[
{
"id": 3,
"nom": "Burger",
"prix": 900,
"id_resto": 2,
"img": "171234222_burger.jpg",
"actif": 1
},
{
"id": 4,
"nom": "Tacos",
"prix": 850,
"id_resto": 2,
"img": "171234223_tacos.jpg",
"actif": 1
}
]
/les_plats/api_plats.php
| Field | Type | Description |
|---|---|---|
| nom | string | Name of the dish |
| prix | number | Dish price |
| id_resto | number | Restaurant ID |
| img | file | Dish image (optional) |
{
"success": true,
"message": "Plat created",
"id": 15,
"img": "171234234_pizza.jpg"
}
/les_plats/api_plats.php?id=1
If using HTML forms send:
POST /les_plats/api_plats.php?id=1&_method=PUT
| Field | Type | Description |
|---|---|---|
| nom | string | Dish name |
| prix | number | Dish price |
| id_resto | number | Restaurant ID |
| img | file | Dish image (optional) |
{
"success": true,
"message": "Plat updated",
"id": 1,
"img": "newpizza.jpg"
}
/les_plats/api_plats.php?id=1
This API does not permanently delete the plat.
It performs a soft delete by setting:
actif = 0
{
"success": true,
"message": "Plat deleted"
}
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request |
| 404 | Plat Not Found |
| 405 | Method Not Allowed |