Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/devdavco/backend_1/llms.txt

Use this file to discover all available pages before exploring further.

The POST /usuarios/create endpoint registers a new user account in the CoworkingBooking system. You must supply at minimum a nombre and a valid, unique email. Optionally include a password_hash value and a rol to control the user’s access level. If the provided email is already associated with an existing account, the request is rejected with a 400 Bad Request response before any data is written.

Request body

nombre
string
required
The user’s full display name. Validated with @NotBlank — cannot be null, empty, or whitespace only. Maximum 100 characters as enforced by the database column.
email
string
required
The user’s email address. Validated with @NotBlank and @Email — must be non-blank and in a valid email format (e.g., [email protected]). Must be unique across all existing users; a duplicate email returns a 400 error (see Error responses below).
password_hash
string
The password value to store for this user. The server stores and returns this field exactly as provided — no server-side hashing is performed. Callers are responsible for hashing passwords before sending them to this endpoint. Maximum 255 characters.
rol
string
A role identifier for the user. The server applies no enum constraint on this field. Common values used in the platform are "admin" and "usuario". Defaults to whatever the underlying database column default is if omitted.

Validation rules

FieldRules
nombreRequired. Cannot be blank.
emailRequired. Must be a valid email format. Must not already exist in the database.
password_hashOptional. Stored as-is.
rolOptional. Free-form string — no enum enforcement.

Request

curl -X POST http://localhost:8080/usuarios/create \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "María García",
    "email": "[email protected]",
    "password_hash": "s3cr3tP@ssword",
    "rol": "usuario"
  }'

Response

201 Created

On success, returns a 201 Created status with the newly created Usuario object in the response body.
id
integer
The auto-generated primary key assigned to the new user by the database.
nombre
string
The user’s full display name as stored.
email
string
The user’s email address as stored.
password_hash
string
The password value exactly as it was supplied in the request.
rol
string
The role identifier as stored.
{
  "id": 3,
  "nombre": "María García",
  "email": "[email protected]",
  "password_hash": "s3cr3tP@ssword",
  "rol": "usuario"
}

Error responses

400 Bad Request — duplicate email

If the supplied email already belongs to an existing user, UsuarioAlreadyExistsException is thrown and the RestExceptionHandler converts it into the following response:
{
  "type": "email-alredy-exist",
  "message": "El usuario con el correo [email protected] ya existe"
}
The type value is "email-alredy-exist" (note the intentional spelling as found in the source). Use this exact string when pattern-matching error types client-side.

400 Bad Request — validation failure

If nombre is blank or email is blank or malformed, Spring’s bean validation returns a 400 error with details about which fields failed.
password_hash is stored exactly as provided and returned in GET responses. The server performs no hashing. Always hash passwords client-side using a strong algorithm (e.g., bcrypt, Argon2) before sending them to this endpoint to avoid storing plaintext credentials.

Build docs developers (and LLMs) love