Course name is Unnamed even if I supply name argument

Jump to solution
nmajethiya
Community Novice

Hello concern,

I'm not able to add course name even if I'm supplying name of course in the create course POST API, with name argument.

Below is the request params
URL : https://canvas.instructure.com/api/v1/accounts/81259/courses
Method: POST
Data (type: application/JSON)
{
"name" : "API Development Using NodeJS",
"course_code" : 1,
"start_at" : "2019-09-27T11:43:36.174Z",
"end_at" : "2019-10-27T11:43:36.174Z",
"license" : "private",
"is_public" : true,
"is_public_to_auth_users" : false,
"public_syllabus" : true,
"public_syllabus_to_auth" : false,
"public_description" : "This course will help you to learn how to create APIs using NodeJS. If you know the basics of NodeJS, this course will help you to create standard APIs",
"allow_student_wiki_edits" : false,
"allow_wiki_comments" : true,
"allow_student_forum_attachments" : true,
"open_enrollment" : true,
"self_enrollment" : true,
"restrict_enrollments_to_course_dates" : true,
"term_id" : 1,
"sis_course_id" : 1,
"integration_id" : 1 ,
"hide_final_grades" : true,
"apply_assignment_group_weights" : true,
"time_zone" : "Asia/Kolkata",
"offer" : true,
"enroll_me" : true,
"default_view" : "feed",
"syllabus_body" : "This is dummy syllabus body",
"enable_sis_reactivation" : false
}

So many other arguments are also not working like time_zone, course_code, end_at etc.
Can anybody tell me what am I missing here ?

1 Solution
akkaufmann
Community Contributor

Hi nmajethiya‌,

The course values need to be within a course object, indicated in the API documentation with the course[ ] notation.

So your JSON data should look something like this:

{
"course" :
{
"name" : "API Development Using NodeJS",
"course_code" : 1,
"start_at" : "2019-09-27T11:43:36.174Z",
"end_at" : "2019-10-27T11:43:36.174Z",
"license" : "private",
"is_public" : true,
"is_public_to_auth_users" : false,
"public_syllabus" : true,
"public_syllabus_to_auth" : false,
"public_description" : "This course will help you to learn how to create APIs using NodeJS. If you know the basics of NodeJS, this course will help you to create standard APIs",
"allow_student_wiki_edits" : false,
"allow_wiki_comments" : true,
"allow_student_forum_attachments" : true,
"open_enrollment" : true,
"self_enrollment" : true,
"restrict_enrollments_to_course_dates" : true,
"term_id" : 1,
"sis_course_id" : 1,
"integration_id" : 1 ,
"hide_final_grades" : true,
"apply_assignment_group_weights" : true,
"time_zone" : "Asia/Kolkata",
"default_view" : "feed",
"syllabus_body" : "This is dummy syllabus body"
},
"offer" : true,
"enroll_me" : true,
"enable_sis_reactivation" : false
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Alex

View solution in original post