I have got the access token for a teacher's account, and have created the course using that token. Now, I am trying to get the list of all the courses, but I don't see the newly created course in that list, that is because teacher user(which I am logged in with) is not yet enrolled to the course as a teacher, which I think only admin can do. Is there anyway I can enroll this teacher to the newly created course which he only created. Or While creating the course the user becomes the teacher to that course.(at no point of time, I ll get admin access token.) Thanks in advance for the help
firstname.lastname@example.org, your request sounds a little different from what we normally see. Is this for some type of class project? Regardless, I'll share with the https://community.canvaslms.com/groups/canvas-developers?sr=search&searchId=d7535cba-0634-4cea-b747-... group to see if they can help. You might want to also join that group to get access to their information and resources.
Thanks for the reply email@example.com
I ll try to be more clear about my question..
I have created a new user account and assigned him the teacher role to one of the courses existing.
Now if the new user is logged in and tries to create a new course, he is automatically assigned the teacher role for the course.
But when he comes through a different tool which first performs the canvas oauth and generates an access token and then tries to create a new course using the canvas APIs, he is not the teacher assigned for the new course.
Though the course is getting created and teacher is shown as None(this course can be seen in the administrators account only).
My question is, when a user(who is already a teacher for one or more courses) is logged in through canvas oauth inside some third party tool and that tool is trying to create a course using the access token generated in the oauth process, why is the user not the teacher for that course. though if he himself logs in and creates a course , he becomes the teacher to that course automatically.
Am I doing something wrong, please ask for anymore details if you want.
Course creation via the UI is different from course creation via the API. Generally speaking, course creation through the UI includes course creation, section creation, and enrollment creation. However, the course creation via the API only creates a site, but section and enrollment. Hope this would be helpful.
Thanks for your reply firstname.lastname@example.org
So, I think it is not possible to create a course and enrolls the logged in user as a teacher from a teacher level oauth & canvas APIs, and it is only possible from the UI. Is this done on purpose or this is a bug/enhancement getting implemented later in the future.. My project requirement is to create a course+section+item(external tool). So I kind of cannot create a new course, though I can load a course list using APIs and choose from the course list and then create section + item(external tool).
If you are developing an LTI tool, I would suggest working with the LMS admin, and getting an admin level OAuth. token. I know in your original inquiry you stated,
at no point of time, I ll get admin access token
But that is an internal concern at your Canvas instance. Teacher-level tokens are limited in what they can access and what changes they can affect for security purposes.
So, I guess my question is, "why are you trying to create the courses and enrollments through API, instead of the Admin UI?" Have you contacted your LMS Admin for help? There are purposely designed limitations to what can be accomplished using a teacher-level OAuth.
Thanks for your reply
Requirement is such that I have to create a course+section+item(external tool) using teacher level oauth, so, looks like it is not possible then. Though I can choose a course from the course list and then add a section + item(external tool), this works fine. I don't understand this why is it made it in such a way that it is possible from the UI and not from the APIs.
At my institute, site creation is request-based. As admin, we have developed course creation tool (based on the API) to handle the requests from faculty and staff.
Thanks for your reply email@example.com
Our tool is used by teachers only, We have this added functionality coming up where we allow them to create a course from our tool which goes directly in the canvas lms. but seems like this is not possible then.