Pacientes API
Base path
Section titled “Base path”/api/pacientes
All Paciente routes require a Bearer token.
Endpoints
Section titled “Endpoints”| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/pacientes | Yes | Create a patient. |
| GET | /api/pacientes | Yes | List patients for the authenticated veterinarian. |
| GET | /api/pacientes/:id | Yes | Get a patient by ID. |
| PUT | /api/pacientes/:id | Yes | Update a patient. |
| DELETE | /api/pacientes/:id | Yes | Delete a patient. |
Create patient
Section titled “Create patient”POST /api/pacientes
Request body:
{ "nombre": "string", "propietario": "string", "email": "string", "fecha": "date string", "sintomas": "string"}Success response: saved Paciente document with veterinario set to the auth user.
List patients
Section titled “List patients”GET /api/pacientes
Success response: array of Paciente documents owned by the authenticated veterinarian.
Get patient by ID
Section titled “Get patient by ID”GET /api/pacientes/:id
Success response: Paciente document.
Errors:
200{ "error": "accion no valida." }when the patient is not owned by the auth user.404{ "error": "Paciente no encontrado." }
Update patient
Section titled “Update patient”PUT /api/pacientes/:id
Request body (all optional, partial updates):
{ "nombre": "string", "propietario": "string", "email": "string", "fecha": "date string", "sintomas": "string"}Success response: updated Paciente document.
Errors:
200{ "error": "accion no valida." }when the patient is not owned by the auth user.404{ "error": "Paciente no encontrado." }
Delete patient
Section titled “Delete patient”DELETE /api/pacientes/:id
Success response:
{ "msg": "Paciente eliminado correctamente." }Errors:
200{ "error": "accion no valida." }when the patient is not owned by the auth user.404{ "error": "Paciente no encontrado." }