curl --request PUT \
--url https://api.example.com/api/personas/:id/foto \
--header 'Content-Type: application/json' \
--data '
{
"foto_url": "<string>"
}
'{
"id": 123,
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"dni": "<string>",
"foto_url": "<string>",
"created_at": "<string>"
}Update the profile photo for a specific person
curl --request PUT \
--url https://api.example.com/api/personas/:id/foto \
--header 'Content-Type: application/json' \
--data '
{
"foto_url": "<string>"
}
'{
"id": 123,
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"dni": "<string>",
"foto_url": "<string>",
"created_at": "<string>"
}admin and asistente roles can access this endpoint.curl -X PUT http://localhost:3000/api/personas/5/foto \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"foto_url": "https://example.com/photos/updated-photo.jpg"
}'
const response = await fetch('http://localhost:3000/api/personas/5/foto', {
method: 'PUT',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
foto_url: 'https://example.com/photos/updated-photo.jpg'
})
});
const updated = await response.json();
{
"id": 5,
"nombres": "María",
"apellidos": "González",
"telefono": "+1234567890",
"dni": "12345678",
"foto_url": "https://example.com/photos/updated-photo.jpg",
"created_at": "2024-03-01T08:00:00.000Z"
}
404 Not Found
{
"message": "Persona no encontrada"
}
500 Internal Server Error
{
"message": "Error al actualizar foto"
}
actualizarFotoPersona which may include additional validation or image processing logic.
/home/daytona/workspace/source/src/routes/personas.routes.js:140