cancel
Showing results for 
Search instead for 
Did you mean: 
dmatchett
Community Member

Is it possible to pull a report that will not only give me quiz grades but the dates submitted?

Jump to solution

I work with ongoing continuing education courses. When we report to the institution that provides CE credit, they generally want to know when the student passed the course. While we can pull a report that lists the grades, it would be a huge help to also have the submission date on that same report. Is this possible already and I have overlooked something? If it isn't possible yet, could it be a customizable report feature?

Thanks for all the help!

- Denise

1 Solution

Accepted Solutions
James
Navigator II

We have an instructor training courses where eligibility to teach enhanced, hybrid, or online courses is determined by a passing grade in an assignment in Canvas.  @kona  manually enters grades so there is no submission info there.  However, we also have an online orientation that the students complete themselves and there is submission information there. Luckily, both sets of information are returned from one API call.

I use the List Assignment Submissions API call to do this:

GET /v1/courses/{course_id}/assignments/{assignment_id}/submissions

That call returns submitted_at and graded_at fields with timestamps of when the assignment was either submitted or graded. It returns null if there is no information. It sounds like in your case, the submitted_at field would be the one you want.

That same API call also returns the grade and score for the assignment.

It does this for all students, although you may need to loop through to get all of them when pagination is required.

There is also a list assignment submissions for sections if you'd rather go that way.

You'll just need to get the course number and assignment number for the assignment you want to use.

View solution in original post

12 Replies
James_Kocher_UF
Learner II

I couldn't find one that could be printed of ALL students and when the accessed the quiz.  I looked at the Live API as well and didn't see anything. I hope someone has done a custom report for this and can share!

kona
Community Coach
Community Coach

I'm not sure if you can easily get this out of Canvas on the front-end, but I know we record this type of information - grade and date that the last "final exam" was completed for our Mandatory Orientation Programming​.  @James ​ might be able to explain what API call (or something else) he uses to get this information.

James
Navigator II

We have an instructor training courses where eligibility to teach enhanced, hybrid, or online courses is determined by a passing grade in an assignment in Canvas.  @kona  manually enters grades so there is no submission info there.  However, we also have an online orientation that the students complete themselves and there is submission information there. Luckily, both sets of information are returned from one API call.

I use the List Assignment Submissions API call to do this:

GET /v1/courses/{course_id}/assignments/{assignment_id}/submissions

That call returns submitted_at and graded_at fields with timestamps of when the assignment was either submitted or graded. It returns null if there is no information. It sounds like in your case, the submitted_at field would be the one you want.

That same API call also returns the grade and score for the assignment.

It does this for all students, although you may need to loop through to get all of them when pagination is required.

There is also a list assignment submissions for sections if you'd rather go that way.

You'll just need to get the course number and assignment number for the assignment you want to use.

View solution in original post

Thanks, James!

For those of us who only know how to use the Live API, do you have a down and dirty explanation of how to pull this API call? Thanks!

Unfortunately, there is no quick and easy / down and dirty solution to it. The API documentation is where I started 3 years ago. There is some required reading at the beginning or you can jump directly to the Submissions API​. Since then, Canvas has come up with some documentation about the process as a whole at their Canvas Dev & Friends blog.

I do it through programming, using either PERL with the LWP modules or PHP using cURL. You can do it through the command line (probably not on a Windows machine), which means that you could script it. The problem is that you're probably going to get results in multiple pages if you have more than 10 students in a course and don't specify the per_page parameter. That will let you go up to 50 students. But then you still need to handle the output, which comes in JSON format. Much easier to do programmatically for any process that needs ran more than once. I tend to find that things people tell me only need once will need ran again, so I go ahead and write the code rather than doing it manually.

I have written my own API libraries, which are mostly incomplete except for the things that I need them to do such as make the API calls, handle the back-end authentication, requests for additional pages, etc. There libraries out there for other languages that will probably work for most people.

Thanks!  I've started to look at that documentation and the course on API/LTI and usually my brain starts swimming after 5 minutes!!

keep-swimming.jpg

Here is some code that may help. It's PHP, sorry if that's not you're thing, but it should provide some guidance and PHP is loaded on a lot of Linux boxes.

I took the API that I had and stripped it out to just handle a GET call. This will handle pagination though. There are probably better ways to handle things and I would definitely put the API call in a function so that I could call it multiple times.

There are four configuration variables to set at the top. Basically, replace the capital letters by the appropriate values. When you're done, it will give you an array of information in the variable $J. I dump it with a print_r() so that you can see it, but you would do additional processing with it.

Also note that this returns information using the Canvas ID's for people, not the SIS ID. That would be an extra call to the API if you don't have those cached. I keep a copy of all the major Canvas IDs from our SIS import to make reports like this easier.

A final note about line 25. My instance of PHP was complaining about the SSL certificates, so I copied the cacert.pem file into the same directory as this one. You will probably have to install a copy of cacert.pem into the local folder or change line 25 to get this to work.

<?php

// Configuration

$course_id = COURSE_ID;

$assignment_id = ASSIGNMENT_ID;

$site_name = 'MYSITE.instructure.com';

$token = 'AUTHORIZATION_TOKEN';

// End of configuration

$url = sprintf('https://%s/api/v1/courses/%s/assignments/%s/submissions',

    $site_name, $course_id, $assignment_id);

// Make the API call

$J = NULL;

$ch = curl_init($url);

curl_setopt_array($ch,

    array(

      CURLOPT_HTTPHEADER => array(

        'Authorization: Bearer ' . $token

      ),

      CURLOPT_RETURNTRANSFER => TRUE,

      CURLOPT_VERBOSE => FALSE,

      CURLOPT_HEADER => TRUE,

      CURLOPT_URL => $url,

      CURLOPT_CAINFO => dirname(__FILE__) . '/cacert.pem'

    ));

$response = curl_exec($ch);

if ($response === FALSE) {

  curl_close($ch);

  exit();

}

$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);

$header = substr($response, 0, $header_size);

$body = substr($response, $header_size);

while (preg_match('/^Link: (.*)$/m', $header, $matches)) {

  $link_info = $matches[1];

  $links = explode(',', $link_info);

  $nextpage = NULL;

  foreach ($links as $link) {

    if (preg_match('/<(.*?)>; rel="next"$/', $link, $matches)) {

      $nextpage = $matches[1];

    }

  }

  if (empty($nextpage)) {

    break;

  }

  curl_setopt($ch, CURLOPT_URL, $nextpage);

  $response = curl_exec($ch);

  if ($response !== FALSE) {

    $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);

    $header = substr($response, 0, $header_size);

    $body .= substr($response, $header_size);

  }

}

if (preg_match('/\]\[/', $body)) {

  $body = preg_replace('/\]\[/', ',', $body);

}

if (preg_match('!^Content-Type: application/json!im', $header)) {

  $J = json_decode($body, TRUE);

}

curl_close($ch);

// $J contains the JSON result

print_r($J);

Thanks!

I've played with PHP in the past.  Time permitting, I'll see what I can do with this!

spaminabox
Surveyor II

I want to do this as well, but sadly, computer illiterate - I don't think I can manage to use this solution unless I find someone who can hold my hand through the process. I don't suppose that Canvas has any plans to work this into the platform...