cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Surveyor

Is it possible to identify or change a Course Home Page through the API?

I am working on an LTI tool to assist faculty in the setup of their course.  I am looking to see if it is possible to identify and/or change the Course Home Page through the APIs.

Basically I am looking for an API version of:

choose course home page

Labels (2)
Tags (1)
2 Replies
Highlighted
Navigator

joseph@fau.edu,

Yes. 

You can obtain the current view using the Get a single course endpoint of the Courses API. You want the default_view.

294206_pastedImage_3.png

From the documentation at the top of the API documentation page where they list the structures, you see this description of default_view.

the type of page that users will see when they first visit the course - 'feed': Recent Activity Dashboard - 'wiki': Wiki Front Page - 'modules': Course Modules/Sections Page - 'assignments': Course Assignments List - 'syllabus': Course Syllabus Page other types may be added in the future

To change it, use the Update a course endpoint.

Here, you need to send the course[default_view] query parameter, which says that allowed values are feed, wiki, modules, syllabus, or assignments.

If you're wanting to use a wiki_page (content page) as the front page, then there are more steps involved.

If you're looking to determine the actual page that is the front page, then use the Show front page endpoint of the Pages API.

If there is no front page set, you get a 404 Not Found error message that says:

"message": "No front page has been set"

If there is a front page set, then you get a Page response, which looks something like this:

294207_pastedImage_8.png

Requesting the front_page doesn't give you the URL of the page to tell which one it is, it comes back as front-page. However, you can use the page_id with requests like /pages/2476060 to get that page. Otherwise, you can get a list of all of the pages and iterate through them looking for the front_page property to be true.

If you want to create a page and make it a the front page, then use the Update/create front page endpoint of the Pages API.

If you want to take an existing page and elevate it to the front page, then use the Update/create page endpoint of the Pages API and set the wiki_page[front_page]=true

You should have a page set as the front page before you can tell Canvas to Update the Course to use a front page.

Highlighted
Surveyor

Hi joseph@fau.edu

Here is the API.

PUT /api/v1/courses/:id

You just need to set "course[default_view]".

Best,

Mu