How to create a new course with Canvas API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2021
09:41 AM
Hello, i'm trying to create a new course with the API but i'm getting this result:
{
"result": null
}
This is what i'm doing:
const courseData = {
course: {
name: titleSection?.title ?? 'Unnamed Course',
course_code: '',
default_view: 'syllabus',
course_format: '',
license: 'private',
syllabus_body: ''
},
enroll_me: true
};
try {
const courseResult = await fetch(`${canvasUrl}/api/v1/accounts/self/courses`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/json'
},
body: JSON.stringify(courseData)
});
return await courseResult.json();
Does anyone know why i'm getting a null?