Skip to main content

Overview

NOT IMPLEMENTED: The PacienteController is empty in the source code. These endpoints are architectural documentation only and will return 404 errors if called. Only the Especialidad endpoints are currently functional.
The Pacientes (Patients) resource is architecturally designed to provide CRUD operations for managing patient records. The data model is defined, but the controller endpoints are not yet implemented.

Endpoints

List All Patients

Retrieve a list of all registered patients.
GET /api/Paciente
Response: 200 OK
patients
array
Array of patient objects
Example Request:
curl -X GET "https://localhost:5001/api/Paciente" \
  -H "Content-Type: application/json"
Example Response:
[
  {
    "id": 1,
    "nombre": "Juan",
    "apellido": "Pérez",
    "dni": "12345678",
    "email": "[email protected]",
    "telefono": "555-1234",
    "fechaNacimiento": "1990-05-15"
  },
  {
    "id": 2,
    "nombre": "María",
    "apellido": "García",
    "dni": "87654321",
    "email": "[email protected]",
    "telefono": "555-5678",
    "fechaNacimiento": "1985-08-22"
  }
]

Get Patient by ID

Retrieve a specific patient by their unique identifier.
GET /api/Paciente/{id}
id
integer
required
The unique identifier of the patient
Response: 200 OK Returns the patient object (same structure as above). Response: 404 Not Found Returned when the patient with the specified ID doesn’t exist. Example Request:
curl -X GET "https://localhost:5001/api/Paciente/1" \
  -H "Content-Type: application/json"
Example Response:
{
  "id": 1,
  "nombre": "Juan",
  "apellido": "Pérez",
  "dni": "12345678",
  "email": "[email protected]",
  "telefono": "555-1234",
  "fechaNacimiento": "1990-05-15"
}

Create Patient

Create a new patient record.
POST /api/Paciente
Request Body
nombre
string
required
Patient’s first name (3-100 characters, letters and spaces only)
apellido
string
required
Patient’s last name (3-100 characters, letters and spaces only)
dni
string
required
Patient’s DNI (exactly 8 digits)
email
string
required
Patient’s email address (must be valid email format)
telefono
string
Patient’s phone number (optional, must be valid phone format)
fechaNacimiento
string
required
Patient’s date of birth in ISO 8601 format (YYYY-MM-DD)
Response: 201 Created Returns the created patient object with the assigned ID. Response: 400 Bad Request Returned when validation fails. Response: 409 Conflict Returned when a patient with the same DNI already exists. Example Request:
curl -X POST "https://localhost:5001/api/Paciente" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Carlos",
    "apellido": "Rodríguez",
    "dni": "45678912",
    "email": "[email protected]",
    "telefono": "555-9876",
    "fechaNacimiento": "1995-03-10"
  }'
Example Response:
{
  "id": 3,
  "nombre": "Carlos",
  "apellido": "Rodríguez",
  "dni": "45678912",
  "email": "[email protected]",
  "telefono": "555-9876",
  "fechaNacimiento": "1995-03-10"
}

Update Patient

Update an existing patient’s information.
PUT /api/Paciente/{id}
id
integer
required
The unique identifier of the patient to update
Request Body Same structure as Create Patient (all fields required).
nombre
string
required
Patient’s first name (3-100 characters, letters and spaces only)
apellido
string
required
Patient’s last name (3-100 characters, letters and spaces only)
dni
string
required
Patient’s DNI (exactly 8 digits)
email
string
required
Patient’s email address (must be valid email format)
telefono
string
Patient’s phone number (optional, must be valid phone format)
fechaNacimiento
string
required
Patient’s date of birth in ISO 8601 format (YYYY-MM-DD)
Response: 200 OK Returns the updated patient object. Response: 404 Not Found Returned when the patient with the specified ID doesn’t exist. Response: 400 Bad Request Returned when validation fails. Response: 409 Conflict Returned when the updated DNI conflicts with another existing patient. Example Request:
curl -X PUT "https://localhost:5001/api/Paciente/3" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Carlos",
    "apellido": "Rodríguez",
    "dni": "45678912",
    "email": "[email protected]",
    "telefono": "555-9999",
    "fechaNacimiento": "1995-03-10"
  }'
Example Response:
{
  "id": 3,
  "nombre": "Carlos",
  "apellido": "Rodríguez",
  "dni": "45678912",
  "email": "[email protected]",
  "telefono": "555-9999",
  "fechaNacimiento": "1995-03-10"
}

Delete Patient

Delete a patient record.
DELETE /api/Paciente/{id}
id
integer
required
The unique identifier of the patient to delete
Response: 204 No Content Returned when the patient is successfully deleted. Response: 404 Not Found Returned when the patient with the specified ID doesn’t exist. Example Request:
curl -X DELETE "https://localhost:5001/api/Paciente/3" \
  -H "Content-Type: application/json"

Validation Rules

Nombre (First Name)

  • Required: Yes
  • Length: 3-100 characters
  • Pattern: Only letters (including Spanish characters: á, é, í, ó, ú, ñ) and spaces
  • Error Message: “El nombre solo puede contener letras y espacios”

Apellido (Last Name)

  • Required: Yes
  • Length: 3-100 characters
  • Pattern: Only letters (including Spanish characters: á, é, í, ó, ú, ñ) and spaces
  • Error Message: “El apellido solo puede contener letras y espacios”

DNI

  • Required: Yes
  • Format: Exactly 8 digits
  • Error Message: “El DNI debe tener exactamente 8 dígitos.”

Email

  • Required: Yes
  • Format: Valid email address
  • Error Message: “El correo electrónico no es válido.”

Telefono (Phone)

  • Required: No
  • Format: Valid phone number format

FechaNacimiento (Date of Birth)

  • Required: Yes
  • Format: ISO 8601 date format (YYYY-MM-DD)

Build docs developers (and LLMs) love