Creates a new activity and optionally associates it with projects.
Authentication
Bearer token for authentication
Required Roles: monitor, admin
Request Body
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
Icon identifier for the activity
Response
Unique identifier for the created 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 POST https://api.sociapp.com/activities \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Fútbol",
"place": "Campo deportivo",
"horaInicio": "16:00",
"horaFin": "18:00",
"diaSemana": "Lunes",
"icon": "soccer",
"idMonitor": 5,
"projectIds": [1, 3]
}'
Example Response
{
"id": 10,
"name": "Fútbol",
"place": "Campo deportivo",
"horaInicio": "16:00",
"horaFin": "18:00",
"diaSemana": "Lunes",
"icon": "soccer",
"idMonitor": 5,
"monitor": "Juan Pérez",
"proyectos": [
{
"id": 1,
"nombre": "Deportes de equipo"
},
{
"id": 3,
"nombre": "Actividades al aire libre"
}
]
}
Validation Rules
- All required fields (
name, place, horaInicio, horaFin, diaSemana) must be provided
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 - Missing Required Fields
{
"statusCode": 400,
"message": "Todos los campos obligatorios deben estar completos"
}
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"
}
500 Internal Server Error
{
"statusCode": 500,
"message": "Failed to create activity"
}