curl --request PUT \
--url https://api.example.com/api/clientes/:id \
--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>"
}
}Update an existing public client record
curl --request PUT \
--url https://api.example.com/api/clientes/:id \
--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>"
}
}curl -X PUT http://localhost:3000/api/clientes/42 \
-H "Content-Type: application/json" \
-d '{
"telefono": "+5559876543",
"email": "[email protected]"
}'
const response = await fetch('http://localhost:3000/api/clientes/42', {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
telefono: '+5559876543',
email: '[email protected]'
})
});
const data = await response.json();
{
"message": "Cliente actualizado",
"cliente": {
"id": 42,
"nombres": "Pedro",
"apellidos": "Martínez",
"telefono": "+5559876543",
"email": "[email protected]",
"created_at": "2024-03-05T15:30:00.000Z"
}
}
404 Not Found
{
"message": "Cliente no encontrado"
}
500 Internal Server Error
{
"message": "Error al actualizar cliente"
}
/home/daytona/workspace/source/src/routes/clientes.routes.js:65