Skip to main content
POST
/
api
/
Modulo
curl --request POST \
  --url https://your-api-host/api/Modulo \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "strNombreModulo": "Reportes",
    "Ruta": "/Module/Reporte",
    "Clave": "reporte"
  }'
{
  "IdModulo": 4,
  "strNombreModulo": "Reportes",
  "Ruta": "/Module/Reporte",
  "Clave": "reporte"
}
Creates a new module. The Clave value you supply becomes the prefix for all permission strings associated with this module.

Authentication

Requires a valid Bearer token.
Authorization: Bearer <token>

Permissions

Requires the modulo.agregar permission. Returns 403 Forbidden if the authenticated user’s profile does not have this permission.

Request body

strNombreModulo
string
required
Display name for the module. Maximum 100 characters.
Ruta
string
required
Frontend route for this module. Maximum 50 characters.
Clave
string
required
Unique key identifier for the module. Maximum 50 characters. This value becomes the prefix in all permission strings for this module.
The Clave you set here determines the permission string prefix. For example, a Clave of reports generates permissions such as reports.agregar, reports.editar, and reports.eliminar.

Validation

The API performs two uniqueness checks before inserting the record:
  • If a module with the same Clave already exists, the request is rejected with 400 Bad Request and the message "Ya existe un módulo con la misma clave."
  • If a module with the same Clave and Ruta combination already exists, the request is rejected with 400 Bad Request and the message "Ya existe un módulo con la misma clave y ruta."

Response fields

IdModulo
integer
required
Auto-assigned ID for the newly created module.
strNombreModulo
string
required
Display name as stored.
Ruta
string
required
Frontend route as stored.
Clave
string
required
Unique key as stored.

Examples

curl --request POST \
  --url https://your-api-host/api/Modulo \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "strNombreModulo": "Reportes",
    "Ruta": "/Module/Reporte",
    "Clave": "reporte"
  }'
{
  "IdModulo": 4,
  "strNombreModulo": "Reportes",
  "Ruta": "/Module/Reporte",
  "Clave": "reporte"
}

Build docs developers (and LLMs) love