/clients/register
POST /api/clients/register
Ruc
y el email
no estén ya registrados.Authorization: Bearer <token>
verificarAutenticacion
verificarAutenticacion
validateCreateClient
validateRequest
{
"Name": "string",
"Ruc": "number",
"Address": "string",
"telephone": "number",
"email": "string",
"credit": "string",
"state": "string"
}
{
"status": "success",
"code": "CLIENT_REGISTERED",
"msg": "Cliente registrado con éxito.",
"data": {
"_id": "ObjectId",
"Name": "string",
"Ruc": number,
"Address": "string",
"telephone": number,
"email": "string",
"credit": "string",
"state": "string"
}
}
{
"status": "error",
"code": "MISSING_FIELD",
"msg": "Los campos 'Ruc' y 'email' son obligatorios."
}
{
"status": "error",
"code": "AUTH_ERROR",
"msg": "Acceso no autorizado. Se requiere token válido."
}
{
"status": "error",
"code": "RESOURCE_ALREADY_EXISTS",
"msg": "El cliente con RUC '{Ruc}' ya existe."
}
{
"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 registrar el cliente. Intente de nuevo más tarde."
}
curl --location --request POST 'https://back-prima-s-a.onrender.com/api/clients/register' \
--header 'User-Agent: insomnia/11.0.0' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3NjI0ZjkwNzY2OWM5MDZjYTM0YThkZSIsInJvbCI6ImFkbWluIiwiaWF0IjoxNzQyOTMxNzg3LCJleHAiOjE3NDI5NjA1ODd9.nwBdY2DmiTAjEYfxGukAQHJkbrsLHqMosjmOSgzfbR4' \
--header 'Content-Type: application/json' \
--data-raw '{
"Name": "Kiwi",
"ComercialName": "Electrodomésticos Kiwi S.A.",
"Ruc": "2351546276001",
"Address": "Av. Amazonas N35-25 y Juan Pablo Sanz",
"telephone": "0987654321",
"email": "info5367@electromoderna.ec",
"credit": "60 días",
"state": "en deuda"
}'
{}