cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tdarrow
Community Contributor

How to update course navigation tabs via the API

Hi all,

I have been trying to figure out a solution to this particular problem the entire morning and have not made much progress, so maybe one of you can help me out. I am trying to change the course navigation tabs in over 100 courses, and to do this manually is extremely time consuming. I have been trying to get the Canvas API to import course settings from my course template into every course we have, but so far the only thing I have been able to do with the API is to import the entire course contents using a POST command with my parameters set to "migration_type: course_copy_importer" and "settings[source_course_id]: <course id>". Unfortunately when I run this POST command, the entire course gets over written with the contents (including the settings) of the source course.
So in light of this, is it possible for me to simply import the course settings into all of my courses using the API? If so, what are the parameters (or location in the REST API Documentation)?

7 Replies
kona
Community Coach
Community Coach

Due to the technical nature of this question I'm going to share it with the Canvas Developers group in the Community. They are the ones that work with this side of Canvas and should hopefully be able to help! In addition, you might consider joining the Developers group and checking out some of their other resources/information!

MattHanes
Community Champion

There is an API call for setting the course tabs. Here is an example of how to hide the assignments tab:
https://institution.instructure.com/api/v1/courses/[course number here]/tabs/assignments?hidden=true

The full information is found here: Tabs - Canvas LMS REST API Documentation

lawd
Community Participant

Tim,

     Running restful api calls on the "tabs" endpoint would be the best way in this case. Check out the documentation here. https://canvas.instructure.com/doc/api/tabs.html ​ I did exactly what are talking about when we first got Canvas off the ground at our college. We had a few hundred template courses where we needed the navigation to look identical.

      I am looking at my script and essentially each navigation tab has it's own endpoint. For instance, the "Grades" tab is at /api/v1/courses/{{course_id}}/tabs/grades. On this url you will need to send a PUT request. The only two properties you really need to send over is {'hidden': [true|false]} and {'position': [int]}.

      My process basically went like this. Gather a list of all of the courses that need the update. Loop through each course to grab the course_id number. Use the course_id number to hit tabs endpoints that need updated in each course, sending over the PUT data in each request.

garth
Community Champion

 @tdarrow ​ I posted something on this very topic not long ago:

It's one use case as an example of customizing the course navigation.

Robbie_Grant
Community Coach
Community Coach

 @tdarrow ​,

Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment.  Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.

Robbie

qnguyen
Community Participant

HI Matt,

I ran the Put command but it only work for 1 course at a time, while I have 1100 course need to do this task. Is there a way to set it for the whole Account?

qnguyen
Community Participant

HI Tim,

Were you able to find a way to update the Tabs for 100 courses at a time?