Exporting assignment description pages

Jump to solution
DanielHOWE
Community Member

I have a number of course for which I need to export or otherwise download the assignment brief pages (the descriptions of the assignments, NOT the submitted student assignments). How can I do this ? I'd like them to be saved in some human-readable, and (ideally) editable format, like Word, or PDF, without requiring an LMS.

Each course has 10-20 assignments and there are about 20 courses.

Labels (1)
0 Likes
2 Solutions
James
Community Champion

@DanielHOWE 

Add /graphiql to the end of your Canvas dashboard URL. This opens the graphQL explorer.

In the middle section, paste this code. Change the 3903130 to the Canvas ID for your course.

 

query assignmentDescriptions {
  course(id: "3903130") {
    assignmentsConnection {
      nodes {
        name
        description
      }
    }
  }
}

 

After changing the course ID, click the Run (black triangle in a circle) button at the top.

The output will appear on the right side.

It will be in JSON format containing the name and assignment description of the assignment. The description will be in HTML format.

It looks something like this.

 

{
  "data": {
    "course": {
      "assignmentsConnection": {
        "nodes": [
          {
            "name": "Public Transit Data",
            "description": "<p>This assignment is part of the <a title=\"Public Transit\" 
... whole bunch of lines removed for brevity ...
towards your grade or have any impact other towards earning a badge.</p>"
          }
        ]
      }
    }
  }
}

 

Now we need to convert it into a usable and readable format.

Select all of the text starting with the left bracket [ after the "nodes": at the top and all the way through the bottom up to and including the closing right bracket ]. Do not include the four closing right braces } at the bottom.

Copy that text.

Now go to some tool that will convert JSON to HTML. I found one at Code Beautify, but there are likely others.

For the Code Beautify converter, you put your JSON in the left side and click Convert to HTML. You can then select and copy the output and then paste it into a Word document. Don't click the Copy button at the top right, it copies the HTML code, not the output. You can also download it as an HTML file and open with a browser (you could then print to a PDF or do whatever you want to with it).

It doesn't have the Canvas styling that goes along with things, but it does get you all of the assignment descriptions really quickly without having to go through each one individually.

Edit: clarified how far to select when copy/pasting the output.

View solution in original post

James
Community Champion

@DanielHOWE 

My initial thought, when I read your message earlier, is that the images within Canvas are the ones not showing up. You have to be logged into Canvas to access those. Those that are external are not behind a login and can be displayed when you convert it.

The graphQL documentation is contained within the explorer when you add the /graphiql to the end of the URL. Try to find it and if you cannot, it may not be there. The REST API documentation is much more thorough.

I find graphQL harder to work with, but I'm not using a library to process it. But when it is available, it is a lot quicker and doesn't deliver a bunch of stuff I don't need. If I'm lucky, I can use it the way it's intended and pull from several different objects at once, minimizing the number of calls. There is a 30 second timeout rather than worrying about how many calls you've made too quickly, which allows me to fetch most of what I want within a single course without having to worry about pagination.

Now the sad news. You can get data from the REST API, GraphQL, Canvas Data 2, and Canvas Data Services Live Events. The last two require extra work and may involve someone with admin rights to set up. Some pieces of information are only available using one approach, some can be obtained from all, or it could be anywhere in the middle. Occasionally, there are still things you want that cannot be obtained anywhere.

A full solution without Puppeteer/Selenium would involve downloading the CSS and storing it locally so that you can make the styles match. Then download all the titles and descriptions for pages, assignments, New Quizzes, etc. Scan those for any internal images and use the Files API to download those and store them locally. Look for any non-Canvas images and store those locally. Then generate an HTML page linked to the CSS, contained the information and referenced the local version of the images. If you wanted, you could take the HTML and convert it to PDF.

 

There are a couple of options that you might want to look at and see if it can work for you. 

The first is exporting each module as an HTML file. My institution doesn't enable offline web support, so I cannot test what this gives you. It's explained in the How do I view course content offline as an HTML file as a student lesson. That is module specific, though, and if you can get it to work at all, you would need to download each module separately.

Another option, which has to be enabled as the "ePub Exporting" feature, is to download an ePub file of the entire course. There is also an option on the Course > Settings page about whether to organize by module (default) or type. How to create the ePub document is explained in How do I view course content offline as an ePub file as a student? When you generate the ePub, it says "Downloading course content allows access to content while offline. Content may include files, pages, assignments, discussion topics or quizzes. Click "Generate ePub" for each course and open with any eReader software to view."

I'm using my beta instance to generate an ePub for my stats class. Probably a bad idea. It's a large class (document wise) and it's not organized by modules, so I will likely not get what I wanted when it's done. It's been 10 minutes and I'm at about 10%. It should be faster in the production instance. I have other things to work on, so I'll probably leave it up to you to see if it will work for you.

Even if the ePub format isn't acceptable as it comes, there might be utilities that would allow you to extract content from it.

View solution in original post