Create a Course pace using API

Jump to solution
michael_william
Community Participant

When I go to create a course pace with the Canvas live api or using my own post request, I get the following error which I am unable to view or resolve.

Live API

{ "errors": [ { "message": "course_pace is missing" } ] }

Post

{'errors': [{'message': 'An error occurred.', 'error_code': 'internal_server_error'}], 'error_report_id': 352935}

The only requirement in the Live API is course_id.

For my post request, I am using the following for the data portion of the post call.

data = {'course_pace': {'end_date':'2023-12-14T08:00:00Z', 'start_date':'2023-08-16T07:00:00Z', 'exclude_weekends': True, 'workflow_state': 'active', 'context_id': course_id, 'context_type': 'Course' }}
 
requests.post(coursePacingURL, params=payload, json=data)
 
Does anyone know what needs to be added or modified in order to create a course pace using api?
Labels (2)
0 Likes
1 Solution
michael_william
Community Participant
Author

Solved the issue needed to create course_pace_module_items_attributes for modules before the creation of course pace can occur. Currently, working on pulling course module items and creating an array using the standardized attribute :

{"id": None, "duration": 0, "module_item_id": module_item['id']}

View solution in original post