curl --request PUT \
--url https://api.example.com/api/personas/me \
--header 'Content-Type: application/json' \
--data '
{
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"dni": "<string>",
"foto_url": "<string>"
}
'{
"id": 123,
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"dni": "<string>",
"foto_url": "<string>",
"created_at": "<string>"
}Update the authenticated user own person profile
curl --request PUT \
--url https://api.example.com/api/personas/me \
--header 'Content-Type: application/json' \
--data '
{
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"dni": "<string>",
"foto_url": "<string>"
}
'{
"id": 123,
"nombres": "<string>",
"apellidos": "<string>",
"telefono": "<string>",
"dni": "<string>",
"foto_url": "<string>",
"created_at": "<string>"
}admin and asistente roles can use this endpoint.curl -X PUT http://localhost:3000/api/personas/me \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"telefono": "+9876543210",
"foto_url": "https://example.com/new-photo.jpg"
}'
const response = await fetch('http://localhost:3000/api/personas/me', {
method: 'PUT',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
telefono: '+9876543210',
foto_url: 'https://example.com/new-photo.jpg'
})
});
const updatedProfile = await response.json();
{
"id": 5,
"nombres": "María",
"apellidos": "González",
"telefono": "+9876543210",
"dni": "12345678",
"foto_url": "https://example.com/new-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 perfil"
}
/home/daytona/workspace/source/src/routes/personas.routes.js:64