cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
carl_corder
Community Participant

Canvas API: how to change course nickname?

Jump to solution

Hello,

I was experimenting with canvasapi in python, and wanted to try changing the nickname of my course. Here is what I have done so far:

  1. Logged into https://canvas.unl.edu went to my profile and generated a new access token that never expires.
  2. Started to write my script:

from canvasapi import Canvastoken = 'my_token'base_url = 'https://canvas.unl.edu' canvas = Canvas(base_url, token)

stats = canvas.get_course(25870)
print(stats.name) # Math Stats I

stats.update(course = {'name': 'Statistical Distributions'})
print(stats.name) # Math Stats I

The program runs without error, but the name never updates. From the Dashboard, I am able to change the nickname of any course I am enrolled in. When I change the nickname and re-run the script, the stats course object updates to:


{...
   'name': 'Statistical Distributions',
   'original_name': 'Math Stats I',
...}

But this isn't working with the canvasapi, not even for courses I have TA access to. Any suggestions?

P.S. This may turn out to be a canvasapi specific issue. In which case, I will post the issue here: Issues · ucfopen/canvasapi · GitHub.

1 Solution

Accepted Solutions
robotcars
Community Champion

I haven't use the CanvasAPI python library, but it looks like you might be using the course.py, which updates the course, not your dashboard. Or mixing canvas.py/get_course(), and then using courses.py/update()...?

I think you need these.

canvasapi/canvas.py at 2c4016c071701bcef949685329acaec6115ffb3b · ucfopen/canvasapi · GitHub 

def get_course_nicknames(self😞

def set_course_nickname(self, course, nickname😞

Also see, Users - Canvas LMS REST API Documentation 

View solution in original post

4 Replies
kmeeusen
Community Coach
Community Coach

Hi  @carl_corder 

I am also going to share your question with the very awesome Canvas Developers‌ group, where there are some smart folks.

Kelley

robotcars
Community Champion

I haven't use the CanvasAPI python library, but it looks like you might be using the course.py, which updates the course, not your dashboard. Or mixing canvas.py/get_course(), and then using courses.py/update()...?

I think you need these.

canvasapi/canvas.py at 2c4016c071701bcef949685329acaec6115ffb3b · ucfopen/canvasapi · GitHub 

def get_course_nicknames(self😞

def set_course_nickname(self, course, nickname😞

Also see, Users - Canvas LMS REST API Documentation 

View solution in original post

carl_corder
Community Participant

Thanks  @kmeeusen ‌ for directing this question into the proper channels.

carl_corder
Community Participant

You are exactly right! The methods do exist, but I was trying to access them from the wrong object. Thanks for your resonse.