Skip to main content

Overview

NOT IMPLEMENTED: The MedicoController 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 Médicos (Doctors) resource is architecturally designed to provide CRUD operations for managing doctor profiles. The data model is defined, but the controller endpoints are not yet implemented.

Endpoints

List All Doctors

Retrieve a list of all registered doctors.
GET /api/Medico
Response: 200 OK
doctors
array
Array of doctor objects
Example Request:
curl -X GET "https://localhost:5001/api/Medico" \
  -H "Content-Type: application/json"
Example Response:
[
  {
    "id": 1,
    "nombre": "Ana",
    "apellido": "Martínez",
    "numeroLicencia": "MED-12345",
    "telefono": "555-1111",
    "especialidadId": 1
  },
  {
    "id": 2,
    "nombre": "Roberto",
    "apellido": "Sánchez",
    "numeroLicencia": "MED-67890",
    "telefono": "555-2222",
    "especialidadId": 2
  }
]

Get Doctor by ID

Retrieve a specific doctor by their unique identifier.
GET /api/Medico/{id}
id
integer
required
The unique identifier of the doctor
Response: 200 OK Returns the doctor object (same structure as above). Response: 404 Not Found Returned when the doctor with the specified ID doesn’t exist. Example Request:
curl -X GET "https://localhost:5001/api/Medico/1" \
  -H "Content-Type: application/json"
Example Response:
{
  "id": 1,
  "nombre": "Ana",
  "apellido": "Martínez",
  "numeroLicencia": "MED-12345",
  "telefono": "555-1111",
  "especialidadId": 1
}

Create Doctor

Create a new doctor record.
POST /api/Medico
Request Body
nombre
string
required
Doctor’s first name (3-100 characters, letters and spaces only)
apellido
string
required
Doctor’s last name (3-100 characters, letters and spaces only)
numeroLicencia
string
required
Doctor’s professional license number
telefono
string
Doctor’s phone number (optional, must be valid phone format)
When creating a doctor, you must assign them to an existing specialty using the especialidadId. However, the CreateMedicoDto doesn’t include this field - the specialty assignment may be handled separately or through a different mechanism.
Response: 201 Created Returns the created doctor object with the assigned ID. Response: 400 Bad Request Returned when validation fails. Response: 409 Conflict Returned when a doctor with the same license number already exists. Example Request:
curl -X POST "https://localhost:5001/api/Medico" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Laura",
    "apellido": "Fernández",
    "numeroLicencia": "MED-54321",
    "telefono": "555-3333"
  }'
Example Response:
{
  "id": 3,
  "nombre": "Laura",
  "apellido": "Fernández",
  "numeroLicencia": "MED-54321",
  "telefono": "555-3333",
  "especialidadId": 0
}

Update Doctor

Update an existing doctor’s information.
PUT /api/Medico/{id}
id
integer
required
The unique identifier of the doctor to update
Request Body Same structure as Create Doctor.
nombre
string
required
Doctor’s first name (3-100 characters, letters and spaces only)
apellido
string
required
Doctor’s last name (3-100 characters, letters and spaces only)
numeroLicencia
string
required
Doctor’s professional license number
telefono
string
Doctor’s phone number (optional, must be valid phone format)
Response: 200 OK Returns the updated doctor object. Response: 404 Not Found Returned when the doctor with the specified ID doesn’t exist. Response: 400 Bad Request Returned when validation fails. Response: 409 Conflict Returned when the updated license number conflicts with another existing doctor. Example Request:
curl -X PUT "https://localhost:5001/api/Medico/3" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Laura",
    "apellido": "Fernández",
    "numeroLicencia": "MED-54321",
    "telefono": "555-4444"
  }'
Example Response:
{
  "id": 3,
  "nombre": "Laura",
  "apellido": "Fernández",
  "numeroLicencia": "MED-54321",
  "telefono": "555-4444",
  "especialidadId": 1
}

Delete Doctor

Delete a doctor record.
DELETE /api/Medico/{id}
id
integer
required
The unique identifier of the doctor to delete
Response: 204 No Content Returned when the doctor is successfully deleted. Response: 404 Not Found Returned when the doctor with the specified ID doesn’t exist. Example Request:
curl -X DELETE "https://localhost:5001/api/Medico/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”

NumeroLicencia (License Number)

  • Required: Yes
  • Format: String (format not restricted)
  • Note: Must be unique across all doctors

Telefono (Phone)

  • Required: No
  • Format: Valid phone number format

EspecialidadId (Specialty ID)

  • Required: Yes (in the entity)
  • Type: Integer
  • Note: Must reference an existing specialty

Specialty Relationship

Each doctor must be associated with a medical specialty. The especialidadId field creates a relationship with the Especialidad entity:
{
  "id": 1,
  "nombre": "Ana",
  "apellido": "Martínez",
  "numeroLicencia": "MED-12345",
  "telefono": "555-1111",
  "especialidadId": 1  // References Especialidad with ID 1 (e.g., "Cardiología")
}
To get the full specialty information, you would need to make a separate request to the Especialidades endpoint.

MedicoResumenDto

A summary DTO used in appointment listings that includes the doctor’s full name and specialty name:
{
  "id": 1,
  "nombreCompleto": "Ana Martínez",
  "especialidad": "Cardiología"
}
This DTO is used in the Citas endpoints to provide enriched doctor information without requiring additional API calls.

Build docs developers (and LLMs) love