Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
hello and good day,
I am tying to create a course by APIs in my locally installation! but the problem is I pass all parameters but in the result my course name is 'Unnamed course' !! and it can't pass my parameters to save! what is my problem?
Thanks.
Solved! Go to Solution.
Thanks, that makes it easier to see what's going wrong, I think your JSON isn't correctly structured, it should be something like:
{"course": {"name": "curl created"}}
Here is an example request using the curl command line tool (authentication header removed) that created a correctly named course:
ccurl -H 'content-type: application/json' --data '{"course": {"name": "curl created"}}' https://instance.instructure.com/api/v1/accounts/1/courses
And this works for me.
You aren't correctly passing the parameters to Canvas so it doesn't detect any of them and creates the 'Unnamed Course'. Are you able to share the request you are sending (without the authentication) to Canvas?
Thank you very much for your support. this is my code :
{
"name": "Expert Medical Level",
"course_code": "A200",
"start_at": "2024-04-25T12:32:19.938Z",
"end_at": "2024-05-25T12:32:19.938Z",
"license": "string",
"is_public": true,
"is_public_to_auth_users": true,
"public_syllabus": true,
"public_syllabus_to_auth": true,
"public_description": "string",
"allow_student_wiki_edits": true,
"allow_wiki_comments": true,
"allow_student_forum_attachments": true,
"open_enrollment": true,
"self_enrollment": true,
"restrict_enrollments_to_course_dates": true,
"term_id": "string",
"sis_course_id": "201",
"integration_id": "string",
"hide_final_grades": true,
"apply_assignment_group_weights": true,
"time_zone": "string",
"offer": true,
"enroll_me": true,
"default_view": "string",
"syllabus_body": "string",
"grading_standard_id": 20,
"grade_passback_setting": "string",
"course_format": "string",
"enable_sis_reactivation": true
}
Thanks, that makes it easier to see what's going wrong, I think your JSON isn't correctly structured, it should be something like:
{"course": {"name": "curl created"}}
Here is an example request using the curl command line tool (authentication header removed) that created a correctly named course:
ccurl -H 'content-type: application/json' --data '{"course": {"name": "curl created"}}' https://instance.instructure.com/api/v1/accounts/1/courses
And this works for me.
To participate in the Instructure Community, you need to sign up or log in:
Sign In