Base URL: http://localhost:3001/api/v1
Role values: 1 = Developer, 2 = Project Manager, 3 = Admin
GET /usuario/me
Returns the authenticated user’s own profile.
Requires authentication. Any role.
Example request
curl http://localhost:3001/api/v1/usuario/me \
-H "Authorization: Bearer <accessToken>"
Example response — 200 OK
{
"success": true,
"message": "Profile retrieved.",
"data": {
"id_usuario": 42,
"nombre": "Ada Lovelace",
"email": "[email protected]",
"rol": 1
}
}
GET /usuario
Returns an array of all registered users.
Requires authentication. Admin only.
Example request
curl http://localhost:3001/api/v1/usuario \
-H "Authorization: Bearer <accessToken>"
Example response — 200 OK
{
"success": true,
"message": "Users retrieved.",
"data": [
{ "id_usuario": 1, "nombre": "Alice", "email": "[email protected]", "rol": 3, "activo": true },
{ "id_usuario": 2, "nombre": "Bob", "email": "[email protected]", "rol": 2, "activo": true }
]
}
GET /usuario/buscar
Search for active users by name. Returns up to 10 results.
Requires authentication. Admin or Project Manager.
Query parameters
Partial name to search for.
Example request
curl "http://localhost:3001/api/v1/usuario/buscar?nombre=ada" \
-H "Authorization: Bearer <accessToken>"
Example response — 200 OK
{
"success": true,
"message": "Users found.",
"data": [
{ "id_usuario": 42, "nombre": "Ada Lovelace", "email": "[email protected]", "rol": 1 }
]
}
PUT /usuario/perfil
Update the authenticated user’s own name or email.
Requires authentication. Any role.
Request body
Example request
curl -X PUT http://localhost:3001/api/v1/usuario/perfil \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{ "nombre": "Ada Byron", "email": "[email protected]" }'
Example response — 200 OK
{
"success": true,
"message": "Profile updated.",
"data": { "id_usuario": 42, "nombre": "Ada Byron", "email": "[email protected]" }
}
PUT /usuario
Change a user’s role.
Requires authentication. Admin only.
Request body
ID of the user to update.
New role. 1 = Developer, 2 = Project Manager, 3 = Admin.
Example request
curl -X PUT http://localhost:3001/api/v1/usuario \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{ "id_usuario": 42, "id_rol": 2 }'
Example response — 200 OK
{
"success": true,
"message": "User role updated.",
"data": { "id_usuario": 42, "id_rol": 2 }
}
PUT /usuario/pm
Promote a user to Project Manager (role 2).
Requires authentication. Admin only.
Request body
ID of the user to promote.
Example request
curl -X PUT http://localhost:3001/api/v1/usuario/pm \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{ "id_usuario": 42 }'
Example response — 200 OK
{
"success": true,
"message": "User promoted to Project Manager.",
"data": { "id_usuario": 42, "id_rol": 2 }
}
PUT /usuario/estado
Toggle a user’s active/inactive status.
Requires authentication. Admin only.
Request body
ID of the user whose status to toggle.
Example request
curl -X PUT http://localhost:3001/api/v1/usuario/estado \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{ "id_usuario": 42 }'
Example response — 200 OK
{
"success": true,
"message": "User status updated.",
"data": { "id_usuario": 42, "activo": false }
}
PUT /usuario/admin/editar
Edit any user’s name or email as an admin.
Requires authentication. Admin only.
Request body
Example request
curl -X PUT http://localhost:3001/api/v1/usuario/admin/editar \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{ "id_usuario": 42, "nombre": "Ada Byron", "email": "[email protected]" }'
Example response — 200 OK
{
"success": true,
"message": "User updated.",
"data": { "id_usuario": 42, "nombre": "Ada Byron", "email": "[email protected]" }
}