cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tmsnvk
Community Member

Requesting help with "child_event_data" calendar event query

Hi there,

I have written a short script that posts calendar events in the given courses. My query parameters look like this:

const requestQuery = `
calendar_event[context_code]=course_2222&
calendar_event[title]=title&
calendar_event[start_at]=2022-08-06T15:00:00&
calendar_event[end_at]=2022-08-06T16:00:00&
calendar_event[duplicate][count]=5&
calendar_event[duplicate][frequency]=weekly`;
 
This works fine and dandy, however, at my institution we usually have at least a few sections within each course and it would be great to create these events in them, so they are visible only to the given section. The API has a "calendar_event[child_event_data]" parameter that I can't figure out how to provide in the correct way. Here is what I have now:
 
const requestQuery = `
calendar_event[context_code]=course_2222&
calendar_event[title]=title&
calendar_event[child_event_data][0][context_code]=course_section_2459&
calendar_event[child_event_data][0][start_at]=2022-08-08T16:00:00&
calendar_event[child_event_data][0][end_at]=2022-08-08T17:00:00&
calendar_event[duplicate][count]=5&
calendar_event[duplicate][frequency]=weekly`;

 

This gives a 500 internal server error.  As far as I understand the documentation, it should be working. Does anyone have a guess or idea what I'm doing wrong?

Thanks in advance!

Tamas

 

EDIT:

Further playing with the API I found out the following: if I create a course-level event, I am able to "swap" it into a section-level event with the following:

/api/v1/calendar_events/28446?
calendar_event[title]=title&
calendar_event[child_event_data][0][context_code]=course_section_4423&
calendar_event[child_event_data][0][start_at]=2022-08-09T16:00:00Z&
calendar_event[child_event_data][0][end_at]=2022-08-09T17:00:00Z&
calendar_event[child_event_data][1][context_code]=course_section_2459&
calendar_event[child_event_data][1][start_at]=2022-08-09T16:00:00Z&
calendar_event[child_event_data][1][end_at]=2022-08-09T17:00:00Z&
calendar_event[duplicate][count]=2&
calendar_event[duplicate][frequency]=weekly

The original course-level event was duplicated weekly, with each having its own eventID. This method updates only one specified instance of that event-series and ignores the count and frequency queries here. It feels lame to loop over each course-level event one by one to update them and I don't understand what the issue is with the original query I posted above when the documentation states that it should be written that way. 

Labels (4)
0 Kudos
0 Replies