/clients/update/:ruc
PATCH /api/clients/update/:ruc
email
, se verifica que no esté registrado por otro cliente.Authorization: Bearer <token>
verificarAutenticacion
verificarAutenticacion
– Verifica la validez del token JWTvalidateUpdateClient
– Valida el parámetro ruc
y los campos del bodyvalidateRequest
– Maneja errores de validaciónParámetro | Tipo | Requerido | Descripción |
---|---|---|---|
ruc | number | ✅ | Número de RUC del cliente a actualizar |
{
"Name": "string (opcional)",
"Address": "string (opcional)",
"telephone": "number (opcional)",
"email": "string (opcional, formato email)",
"credit": "string (opcional)",
"state": "string (opcional)"
}
{
"status": "success",
"code": "CLIENT_UPDATED",
"msg": "Cliente actualizado correctamente.",
"data": {
"Name": "string",
"Ruc": number,
"Address": "string",
"telephone": number,
"email": "string",
"credit": "string",
"state": "string"
}
}
{
"status": "error",
"code": "MISSING_FIELD",
"msg": "El parámetro 'ruc' es obligatorio."
}
{
"status": "error",
"code": "NO_UPDATABLE_FIELDS",
"msg": "No se proporcionaron campos válidos para actualizar."
}
{
"status": "error",
"code": "AUTH_ERROR",
"msg": "Acceso no autorizado. Se requiere token válido."
}
{
"status": "error",
"code": "NOT_FOUND",
"msg": "No se encontró cliente con RUC {ruc} para actualizar."
}
{
"status": "error",
"code": "RESOURCE_ALREADY_EXISTS",
"msg": "El email '{email}' ya está registrado por otro cliente."
}
{
"status": "error",
"code": "SERVER_ERROR",
"msg": "Ha ocurrido un error inesperado al actualizar el cliente. Intente de nuevo más tarde."
}
curl --location --request PATCH 'https://back-prima-s-a.onrender.com/api/clients/update/' \
--header 'User-Agent: insomnia/11.0.0' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3NjI0ZjkwNzY2OWM5MDZjYTM0YThkZSIsInJvbCI6ImFkbWluIiwiaWF0IjoxNzQyOTMxNzg3LCJleHAiOjE3NDI5NjA1ODd9.nwBdY2DmiTAjEYfxGukAQHJkbrsLHqMosjmOSgzfbR4' \
--header 'Content-Type: application/json' \
--data-raw '{
"Name": "Juan Pérez",
"Address": "Av. Principal 123, Quito",
"telephone": 987654321,
"credit": "Rechazado",
"state": "Falto"
}'
{"msg":"Cliente actualizado correctamente","data":{"Name":"Juan Pérez","Address":"Av. Principal 123, Quito","telephone":987654321,"credit":"Rechazado","state":"Falto"}}