Updates an existing activity by ID. All fields are optional and only provided fields will be updated.
Authentication
Bearer token for authentication
Required Roles: monitor, admin
Path Parameters
The unique identifier of the activity to update
Request Body
All fields are optional. Only include fields you want to update.
Location where the activity takes place
Start time in HH:MM or HH:MM:SS format. Must be before horaFin.
End time in HH:MM or HH:MM:SS format. Must be after horaInicio.
Day of the week when the activity occurs
ID of the monitor assigned to this activity
Array of project IDs to associate with this activity. This replaces all existing associations.
Icon identifier for the activity
Response
Unique identifier for the activity
Location where the activity takes place
Start time in HH:MM format
Icon identifier for the activity
ID of the assigned monitor
Name of the assigned monitor
Array of associated projects
Example Request
curl -X PUT https://api.sociapp.com/activities/10 \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"place": "Nuevo campo deportivo",
"horaInicio": "17:00",
"horaFin": "19:00",
"projectIds": [1, 2, 3]
}'
Example Response
{
"id": 10,
"name": "Fútbol",
"place": "Nuevo campo deportivo",
"horaInicio": "17:00",
"horaFin": "19:00",
"diaSemana": "Lunes",
"icon": "soccer",
"idMonitor": 5,
"monitor": "Juan Pérez",
"proyectos": [
{
"id": 1,
"nombre": "Deportes de equipo"
},
{
"id": 2,
"nombre": "Arte y creatividad"
},
{
"id": 3,
"nombre": "Actividades al aire libre"
}
]
}
Project Association Behavior
When updating projectIds:
- The activity is removed from projects not in the new list
- The activity is added to projects in the new list that didn’t have it
- The activity remains in projects that are in both the old and new lists
This means projectIds replaces the entire set of associated projects.
Validation Rules
- If both
horaInicio and horaFin are present (either existing or updated), horaInicio must be before horaFin
- Time format must be HH:MM or HH:MM:SS with valid hours (00-23) and minutes (00-59)
Error Responses
400 Bad Request - Invalid Time Range
{
"statusCode": 400,
"message": "La hora de inicio debe ser anterior a la hora de fin"
}
{
"statusCode": 400,
"message": "Formato de hora inválido"
}
401 Unauthorized
{
"statusCode": 401,
"message": "Unauthorized"
}
403 Forbidden
{
"statusCode": 403,
"message": "Forbidden resource"
}
404 Not Found
{
"statusCode": 404,
"message": "Actividad no encontrada"
}
500 Internal Server Error
{
"statusCode": 500,
"message": "Failed to update activity"
}