Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Miguel-Rodriguez15/msvc/llms.txt

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

A composite operation that (1) creates a new Usuario in msvc-usuarios by calling POST / via OpenFeign, then (2) creates a CursoUsuario junction record that links the new user to the specified course. Both steps occur inside the same transactional service method. If either step throws a FeignException, the entire operation fails and a 404 response is returned — the course enrollment is not recorded in that case. Use this endpoint when you need to register a brand-new user and immediately assign them to a course in one HTTP call. To enroll a user who already exists in msvc-usuarios, use PUT /asignar-usuario/{cursoId} instead. No authentication is required for this endpoint.

Endpoint

POST http://localhost:8002/crear-usuario/{cursoId}
Via API Gateway:
POST http://localhost:8090/api/cursos/crear-usuario/{cursoId}

Path Parameters

cursoId
number
required
The primary key of the course the newly created user will be enrolled in.

Request Body

Content-Type: application/json
nombre
string
required
Full name of the new user. Forwarded to msvc-usuarios verbatim.
email
string
required
Email address of the new user. Must be unique in msvc-usuarios.
password
string
required
Plain-text password. msvc-usuarios is responsible for hashing before persistence.

Response

201 Created — The Usuario object returned by msvc-usuarios after creation, reflecting the assigned id and persisted fields.
id
number
Auto-generated primary key assigned by msvc-usuarios.
nombre
string
Name of the newly created user.
email
string
Email address of the newly created user.
password
string
Hashed password as stored by msvc-usuarios.

404 Not Found — Returned when the Feign call to msvc-usuarios throws a FeignException (e.g. validation failure, duplicate email, service unavailable) or when no course with cursoId exists.
mensaje
string
Error message prefixed with "No se pudo crear el usuarioo error en la comunicacion: " followed by the Feign exception message. Note: the string is produced by concatenating "No se pudo crear el usuario" and "o error en la comunicacion: " in the controller, resulting in a double-o and no space between usuario and o.

Examples

Request

curl -X POST http://localhost:8002/crear-usuario/1 \
  -H "Content-Type: application/json" \
  -d '{"nombre":"Ana","email":"ana@test.com","password":"pass"}'

Response — 201 Created

{
  "id": 8,
  "nombre": "Ana",
  "email": "ana@test.com",
  "password": "$2a$10$hashed..."
}

Response — 404 Not Found (Feign error from msvc-usuarios)

{
  "mensaje": "No se pudo crear el usuarioo error en la comunicacion: [400 Bad Request] during [POST] to [http://msvc-usuarios/]"
}

This endpoint creates the user inside msvc-usuarios (a separate microservice and separate database). If the user is created successfully but saving the CursoUsuario record subsequently fails at the database level (e.g. a constraint violation), the user may already exist in msvc-usuarios without being enrolled — there is no distributed rollback. Design your retry logic accordingly.

Build docs developers (and LLMs) love