curl --request POST \
--url https://api.example.com/api/clientes \
--header 'Content-Type: application/json' \
--data '
{
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"email": "<string>"
}
'{
"message": "<string>",
"cliente": {
"id": 123,
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"email": "<string>",
"created_at": "<string>"
}
}Create a new public client record
curl --request POST \
--url https://api.example.com/api/clientes \
--header 'Content-Type: application/json' \
--data '
{
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"email": "<string>"
}
'{
"message": "<string>",
"cliente": {
"id": 123,
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"email": "<string>",
"created_at": "<string>"
}
}POST /api/citas, but this endpoint allows manual client creation.curl -X POST http://localhost:3000/api/clientes \
-H "Content-Type: application/json" \
-d '{
"nombres": "Pedro",
"apellidos": "Martínez",
"telefono": "+5551234567",
"email": "[email protected]"
}'
const response = await fetch('http://localhost:3000/api/clientes', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
nombres: 'Pedro',
apellidos: 'Martínez',
telefono: '+5551234567',
email: '[email protected]'
})
});
const data = await response.json();
{
"message": "Cliente creado",
"cliente": {
"id": 42,
"nombres": "Pedro",
"apellidos": "Martínez",
"telefono": "+5551234567",
"email": "[email protected]",
"created_at": "2024-03-05T15:30:00.000Z"
}
}
400 Bad Request
{
"message": "Error al crear cliente"
}
nombres field)./home/daytona/workspace/source/src/routes/clientes.routes.js:9