The Menus endpoint manages top-level menu entries in the hierarchical permission system. Menus contain multiple Vistas (views) and represent the primary navigation structure.
Hierarchy
Menu (Top Level)
└── Vista (Views within menu)
└── Opciones (Actions within view)
Model Structure
The Menu model represents the top level of the permission hierarchy.
Fields
Auto-incremented primary key identifying the menu
Name of the menu (max 40 characters)
Description of the menu’s purpose (max 40 characters)
Endpoints
Retrieve all menus in the system.
Response
Unique identifier for the menu
Menu status (0: Inactive, 1: Active)
Example Response
{
"results": [
{
"id_menu": 1,
"nombre_menu": "Dashboard",
"descripcion": "Main dashboard menu",
"estado": 1
},
{
"id_menu": 2,
"nombre_menu": "Campañas",
"descripcion": "Campaign management menu",
"estado": 1
},
{
"id_menu": 3,
"nombre_menu": "Usuarios",
"descripcion": "User management menu",
"estado": 1
}
]
}
GET /api/menus/{id_menu}/
Retrieve details of a specific menu.
Path Parameters
The unique identifier of the menu
Response
Unique identifier for the menu
Example Response
{
"id_menu": 1,
"nombre_menu": "Dashboard",
"descripcion": "Main dashboard menu",
"estado": 1
}
Create a new menu in the system.
Request Body
Name of the menu (max 40 characters)
Description of the menu (max 40 characters)
Status of the menu (0: Inactive, 1: Active)
Example Request
{
"nombre_menu": "Reportes",
"descripcion": "Reports and analytics menu",
"estado": 1
}
Response
The ID of the newly created menu
PUT /api/menus/{id_menu}/
PATCH /api/menus/{id_menu}/
Update an existing menu. Use PUT for full updates or PATCH for partial updates.
Path Parameters
The unique identifier of the menu to update
Request Body
DELETE /api/menus/{id_menu}/
Delete a menu from the system. Note: This will cascade delete all associated Vistas and their Opciones.
Path Parameters
The unique identifier of the menu to delete
Usage Notes
- Menus form the top level of the permission hierarchy
- Each menu can contain multiple Vistas (views)
- Deleting a menu will cascade delete all associated data
- Menu estado should be set to 0 to disable rather than deleting
- Use PermisosXRol to assign menu access to specific roles