Skip to main content

Get User by ID

Authentication required
GET /api/buscar/{id}
Retrieves a single user by their ID.
id
long
required
The unique identifier of the user

Response

id
long
User’s unique identifier
nombre
string
User’s first name
apellidoPa
string
User’s paternal last name
apellidoMa
string
User’s maternal last name
telefono
string
User’s phone number
correo
string
User’s email address
username
string
User’s username for authentication
foto
string
User’s profile photo filename
fecha
date
User registration date (format: yyyy-MM-dd)
dni
string
User’s national identification number
enable
string
User status (“Activo” or “No Activo”)
idTipoUsu
long
Role ID (1 = ADMIN, 2 = USER)
tiporol
object
User’s role information
curl -X GET "https://api.investgo.com/api/buscar/1" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "id": 1,
  "nombre": "Juan",
  "apellidoPa": "Pérez",
  "apellidoMa": "García",
  "telefono": "987654321",
  "correo": "[email protected]",
  "username": "juanperez",
  "foto": "default.png",
  "fecha": "2024-01-15",
  "dni": "12345678",
  "enable": "Activo",
  "idTipoUsu": 2,
  "tiporol": {
    "idTipoUsu": 2,
    "tipo": "USER"
  }
}

Get User by Username

GET /api/{username}
Retrieves a user by their username.
username
string
required
The username to search for
curl -X GET "https://api.investgo.com/api/juanperez" \
  -H "Authorization: Bearer YOUR_TOKEN"

List Active Users

GET /api/active/listaUsuario
Retrieves all active users (excludes “No Activo” users).
curl -X GET "https://api.investgo.com/api/active/listaUsuario" \
  -H "Authorization: Bearer YOUR_TOKEN"
[
  {
    "id": 1,
    "nombre": "Juan",
    "apellidoPa": "Pérez",
    "apellidoMa": "García",
    "correo": "[email protected]",
    "username": "juanperez",
    "enable": "Activo",
    "idTipoUsu": 2
  }
]

List All Users

GET /api/listarusuarios
Retrieves all users in the system.
curl -X GET "https://api.investgo.com/api/listarusuarios" \
  -H "Authorization: Bearer YOUR_TOKEN"

List Roles

GET /api/listarRoles
Retrieves all available user roles.
curl -X GET "https://api.investgo.com/api/listarRoles" \
  -H "Authorization: Bearer YOUR_TOKEN"
[
  {
    "idTipoUsu": 1,
    "tipo": "ADMIN"
  },
  {
    "idTipoUsu": 2,
    "tipo": "USER"
  }
]

Register User

POST /api/registrar
Creates a new user account.
  • Username, email, and DNI must be unique
  • Password will be encrypted automatically
  • User photo defaults to “default.png”
  • A wallet (cartera) is automatically created with 0 balance
  • Cannot register with ADMIN role

Request Body

nombre
string
required
User’s first name
apellidoPa
string
required
User’s paternal last name
apellidoMa
string
required
User’s maternal last name
telefono
string
required
User’s phone number
correo
string
required
User’s email address
username
string
required
Desired username
password
string
required
User’s password (will be encrypted)
dni
string
required
User’s national identification number
idTipoUsu
long
required
Role ID (2 for USER)
curl -X POST "https://api.investgo.com/api/registrar" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Juan",
    "apellidoPa": "Pérez",
    "apellidoMa": "García",
    "telefono": "987654321",
    "correo": "[email protected]",
    "username": "juanperez",
    "password": "securePassword123",
    "dni": "12345678",
    "idTipoUsu": 2
  }'
{
  "mensaje": "Has sido registrado exitosamente",
  "empleado": {
    "id": 5,
    "nombre": "Juan",
    "apellidoPa": "Pérez",
    "apellidoMa": "García",
    "telefono": "987654321",
    "correo": "[email protected]",
    "username": "juanperez",
    "foto": "default.png",
    "fecha": "2024-03-15",
    "dni": "12345678",
    "enable": "Activo",
    "idTipoUsu": 2
  },
  "cartera": {
    "idCartera": 5,
    "saldo": 0,
    "idUsu": 5
  }
}

Update User

PUT /api/actualizar
Updates an existing user’s information.
  • Cannot update username, password, role (idTipoUsu), or registration date
  • Can only update: name, phone, email, and DNI
  • Email and DNI must remain unique

Request Body

id
long
required
User ID to update
nombre
string
Updated first name
apellidoPa
string
Updated paternal last name
apellidoMa
string
Updated maternal last name
telefono
string
Updated phone number
correo
string
Updated email (must be unique)
dni
string
Updated DNI (must be unique)
curl -X PUT "https://api.investgo.com/api/actualizar" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "id": 5,
    "nombre": "Juan Carlos",
    "apellidoPa": "Pérez",
    "apellidoMa": "García",
    "telefono": "987654322",
    "correo": "[email protected]",
    "dni": "12345678"
  }'
{
  "mensaje": "Usuario actualizado exitosamente"
}

Delete User (Soft Delete)

DELETE /api/eliminar/{id}
Soft deletes a user by setting their status to “No Activo”.
This is a soft delete - the user record is not removed from the database, only marked as inactive.
id
long
required
The ID of the user to delete
curl -X DELETE "https://api.investgo.com/api/eliminar/5" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "mensaje": "Se elimino exitosamente el usuario"
}

Build docs developers (and LLMs) love