Skip to main content
GET
/
api
/
menus
Menus
curl --request GET \
  --url https://api.example.com/api/menus \
  --header 'Content-Type: application/json' \
  --data '
{
  "nombre_menu": "<string>",
  "descripcion": "<string>",
  "estado": 123
}
'
{
  "results": [
    {
      "id_menu": 123,
      "nombre_menu": "<string>",
      "descripcion": "<string>",
      "estado": 123
    }
  ],
  "id_menu": 123,
  "nombre_menu": "<string>",
  "descripcion": "<string>",
  "estado": 123
}

Menus API

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

id_menu
integer
required
Auto-incremented primary key identifying the menu
nombre_menu
string
required
Name of the menu (max 40 characters)
descripcion
string
Description of the menu’s purpose (max 40 characters)
estado
integer
required
Status of the menu
  • 0: Inactive
  • 1: Active

Endpoints

List All Menus

GET /api/menus/
Retrieve all menus in the system.

Response

results
array
id_menu
integer
Unique identifier for the menu
nombre_menu
string
Menu name
descripcion
string
Menu description
estado
integer
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 Menu by ID

GET /api/menus/{id_menu}/
Retrieve details of a specific menu.

Path Parameters

id_menu
integer
required
The unique identifier of the menu

Response

id_menu
integer
Unique identifier for the menu
nombre_menu
string
Menu name
descripcion
string
Menu description
estado
integer
Menu status

Example Response

{
  "id_menu": 1,
  "nombre_menu": "Dashboard",
  "descripcion": "Main dashboard menu",
  "estado": 1
}

Create Menu

POST /api/menus/
Create a new menu in the system.

Request Body

nombre_menu
string
required
Name of the menu (max 40 characters)
descripcion
string
Description of the menu (max 40 characters)
estado
integer
required
Status of the menu (0: Inactive, 1: Active)

Example Request

{
  "nombre_menu": "Reportes",
  "descripcion": "Reports and analytics menu",
  "estado": 1
}

Response

id_menu
integer
The ID of the newly created menu
nombre_menu
string
Menu name
descripcion
string
Menu description
estado
integer
Menu status

Update 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

id_menu
integer
required
The unique identifier of the menu to update

Request Body

nombre_menu
string
Updated menu name
descripcion
string
Updated description
estado
integer
Updated status

Delete Menu

DELETE /api/menus/{id_menu}/
Delete a menu from the system. Note: This will cascade delete all associated Vistas and their Opciones.

Path Parameters

id_menu
integer
required
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

Build docs developers (and LLMs) love