Skip to main content
POST
/
api
/
Usuario
/
Guardar
Create User
curl --request POST \
  --url https://api.example.com/api/Usuario/Guardar \
  --header 'Content-Type: application/json' \
  --data '
{
  "nombreCompleto": "<string>",
  "correo": "<string>",
  "idRol": 123,
  "clave": "<string>",
  "esActivo": 123
}
'
{
  "status": true,
  "value": {
    "idUsuario": 123,
    "nombreCompleto": "<string>",
    "correo": "<string>",
    "idRol": 123,
    "rolDescripcion": "<string>",
    "clave": "<string>",
    "esActivo": 123
  },
  "msg": "<string>"
}

Endpoint

POST /api/Usuario/Guardar
Creates a new user in the Sistema Venta application with the specified details and role assignment.

Request Body

nombreCompleto
string
required
Full name of the user
correo
string
required
Email address for the user (must be unique)
idRol
integer
required
Role identifier to assign to the user
clave
string
required
Password for the user account
esActivo
integer
default:1
Active status (1 = active, 0 = inactive)

Response

The endpoint returns a Response<UsuarioDTO> wrapper containing the created user object.
status
boolean
required
Indicates if the user was successfully created
value
UsuarioDTO
The created user object
msg
string
Error message if status is false

Example Request

curl -X POST "https://api.example.com/api/Usuario/Guardar" \
  -H "Content-Type: application/json" \
  -d '{
    "nombreCompleto": "Carlos Martínez",
    "correo": "[email protected]",
    "idRol": 2,
    "clave": "securePassword123",
    "esActivo": 1
  }'

Example Response

{
  "status": true,
  "value": {
    "idUsuario": 3,
    "nombreCompleto": "Carlos Martínez",
    "correo": "[email protected]",
    "idRol": 2,
    "rolDescripcion": "Empleado",
    "clave": "hashed_password",
    "esActivo": 1
  },
  "msg": null
}

Implementation Details

  • Controller: UsuarioController.cs:67
  • Service Method: IUsuarioService.Crear(UsuarioDTO)
  • Request Source: [FromBody]
  • Response Type: Response<UsuarioDTO>
  • HTTP Status: Always returns 200 OK (check status field for actual result)

Notes

  • The idUsuario field in the request body is ignored; the ID is auto-generated
  • Email addresses must be unique in the system
  • Passwords should be sent in plain text and will be hashed by the service layer
  • The rolDescripcion field is populated automatically based on the idRol

Build docs developers (and LLMs) love