Calendar
This endpoint group provides methods for managing calendar events, including fetching, creating, updating, and deleting them. It also includes a system-level endpoint for updating event statuses.
Endpoints
POST /api/rpc (Method: CalendarRpc.getEvents)
Description: Fetches calendar events for a given context and date range.
Request Body:
{ "method": "CalendarRpc.getEvents", "params": { "contextId": "string", "start": "2023-10-27T10:00:00.000Z", "end": "2023-10-27T11:00:00.000Z" } }Parameters:
Name Type Required Description contextIdStringYes The ID of the context this event belongs to (e.g., studentId, projectId). startStringYes The start date and time of the range, in ISO 8601 format with offset. endStringYes The end date and time of the range, in ISO 8601 format with offset. Response:
{ "success": true, "data": [ { "_id": "653b6e8e8e8e8e8e8e8e8e8e", "contextId": "student123", "title": "Meeting with Advisor", "description": "Discuss project progress.", "start": "2023-10-27T10:00:00.000Z", "end": "2023-10-27T11:00:00.000Z", "allDay": false, "status": "scheduled", "reminders": [], "eventType": "meeting", "relatedEntityId": null, "extendedProps": {}, "createdAt": "2023-10-27T09:00:00.000Z", "updatedAt": "2023-10-27T09:00:00.000Z" } ] }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "CalendarRpc.getEvents", "params": { "contextId": "student123", "start": "2023-10-27T10:00:00.000Z", "end": "2023-10-27T11:00:00.000Z" } }'
POST /api/rpc (Method: CalendarRpc.create)
Description: Creates a new calendar event.
Request Body:
{ "method": "CalendarRpc.create", "params": { "contextId": "string", "title": "string", "description": "string", "start": "2023-10-27T10:00:00.000Z", "end": "2023-10-27T11:00:00.000Z", "allDay": false, "status": "scheduled", "reminders": [ { "unit": "minutes", "value": 15 } ], "eventType": "string", "relatedEntityId": "string", "extendedProps": {} } }Parameters:
Name Type Required Description contextIdStringYes The context this event belongs to (e.g., studentId, projectId). titleStringYes Event title. descriptionStringNo Event description. startStringYes The start date and time of the event, in ISO 8601 format. endStringYes The end date and time of the event, in ISO 8601 format. allDayBooleanNo Whether the event is an all-day event. Defaults to false.statusEnumNo The current status of the event. Can be scheduled,in-progress,completed,missed, orcancelled. Defaults toscheduled.remindersArray<Object>No Array of reminders to be sent before the event. Each object has unit(minutes, hours, days) andvalue(number).eventTypeStringNo Category of the event for filtering/coloring (e.g., 'class', 'assessment', 'personal'). relatedEntityIdStringNo Link to another entity, like a courseId or assessmentScheduleId. extendedPropsObjectNo Additional properties for the event. Response:
{ "success": true, "data": { "_id": "653b6e8e8e8e8e8e8e8e8e8e", "contextId": "student123", "title": "New Event", "description": null, "start": "2023-10-27T10:00:00.000Z", "end": "2023-10-27T11:00:00.000Z", "allDay": false, "status": "scheduled", "reminders": [], "eventType": null, "relatedEntityId": null, "extendedProps": {}, "createdAt": "2023-10-27T09:00:00.000Z", "updatedAt": "2023-10-27T09:00:00.000Z" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "CalendarRpc.create", "params": { "contextId": "student123", "title": "New Event", "start": "2023-10-27T10:00:00.000Z", "end": "2023-10-27T11:00:00.000Z" } }'
POST /api/rpc (Method: CalendarRpc.update)
Description: Updates an existing calendar event.
Request Body:
{ "method": "CalendarRpc.update", "params": { "_id": "string", "title": "string", "description": "string", "start": "2023-10-27T10:00:00.000Z" } }Parameters:
Name Type Required Description _idStringYes MongoDB ObjectId of the event to update. contextIdStringNo The context this event belongs to (e.g., studentId, projectId). titleStringNo Event title. descriptionStringNo Event description. startStringNo The start date and time of the event, in ISO 8601 format. endStringNo The end date and time of the event, in ISO 8601 format. allDayBooleanNo Whether the event is an all-day event. statusEnumNo The current status of the event. Can be scheduled,in-progress,completed,missed, orcancelled.remindersArray<Object>No Array of reminders to be sent before the event. Each object has unit(minutes, hours, days) andvalue(number).eventTypeStringNo Category of the event for filtering/coloring (e.g., 'class', 'assessment', 'personal'). relatedEntityIdStringNo Link to another entity, like a courseId or assessmentScheduleId. extendedPropsObjectNo Additional properties for the event. Response:
{ "success": true, "data": { "_id": "653b6e8e8e8e8e8e8e8e8e8e", "contextId": "student123", "title": "Updated Event Title", "description": null, "start": "2023-10-27T10:00:00.000Z", "end": "2023-10-27T11:00:00.000Z", "allDay": false, "status": "scheduled", "reminders": [], "eventType": null, "relatedEntityId": null, "extendedProps": {}, "createdAt": "2023-10-27T09:00:00.000Z", "updatedAt": "2023-10-27T09:30:00.000Z" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "CalendarRpc.update", "params": { "_id": "653b6e8e8e8e8e8e8e8e8e8e", "title": "Updated Event Title" } }'
POST /api/rpc (Method: CalendarRpc.delete)
Description: Deletes a calendar event.
Request Body:
{ "method": "CalendarRpc.delete", "params": { "_id": "string" } }Parameters:
Name Type Required Description _idStringYes MongoDB ObjectId of the event to delete. Response:
{ "success": true, "data": { "success": true } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "CalendarRpc.delete", "params": { "_id": "653b6e8e8e8e8e8e8e8e8e8e" } }'