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

Canvas live api for free account?

Jump to solution

Hi, can i use canvas live api if I only have a free for teacher account? What’s the address I should use? Thanks!

1 Solution

Accepted Solutions
8 Replies
chofer
Community Coach
Community Coach

Hello there,  @thioclassroom  Welcome to the Canvas Community.  Thank you for posting your question.  I am not totally sure of an answer for you, but I've gone ahead and shared your question with the Canvas Developers‌ group here in the Community in hopes that your question will get some additional exposure.  If you are not yet following this group, please use the link that I have provide, and then click on the "Follow" button at the top right corner of the page.  Next to this button, you'll also find a button called "Actions".  Go there as well, and then click on "Join group".  I hope this will be of help to you, Monique.  Good luck!

thioclassroom
Community Member

That's the address I used before I posted this. It gave me error messages.  I tried it again just now and this is the error I got in the response body: I'm trying to use it to list submissions for multiple assignments. Anybody knows how to do fix this? I also know where to get the course id (it's on the url of my class when i go to "course").Thanks!

Request url...

https://canvas.instructure.com:443/api/v1/courses/1635306/students/submissions

Response body...

{   "status": "unauthorized",   "errors": [     {       "message": "user not authorized to perform that action"     }   ] }

I also watched the video tutorial on canvas live api from the instructurecon from 2016. I got the access token from account --> setting --> new access token.

Add ?student_ids[]=all to give:

    https://canvas.instructure.com:443/api/v1/courses/1635306/students/submissions?student_ids[]=all

Its explained at: Submissions - Canvas LMS REST API Documentation 

Hi Peter,

Thank you. I am able to generate a report by entering "all" in the student id field. However, the report only consists of 10 assignments (10 rows). I used JSON to CSV Converter to put the data to csv. How do i get the whole assignments in that course? Thankyou.

You can try adding the per_page parameter (?student_ids[]=all&per_page=100) but there is a limit on how many rows you can get at once.

To get more, you have to use the pagination links.  See: Pagination - Canvas LMS REST API Documentation 

For most, but not all, API endpoints you can use things like &page=1&per_page=100 etc.

But if you are doing this programatically, rather than manually, you should use the pagination URLs as returned by the API.

how do i add that page perimeter or the pagination links to the canvas live api? clueless here...

Once you get into pagination issues (more than 10 items), you're moving beyond what the Live API was designed for. It's for you to test things out and then you use a different program once you've figured out what you're doing. For advanced API research, most people using a REST client for their browser. I use ARC (Advanced REST Client for Chrome) but many people use PostMan. The other option is to write a computer program (most languages have library support for REST calls) that makes the calls and acts on it.

If you have less than 100 items to retrieve, you can usually log into Canvas and put the URL directly into the browser's location bar. I've split this into three parts (protocol and host on line 1, pathname on line 2, and query string on line 3) to make it more readable

https://canvas.instructure.com
/api/v1/courses/1635306/students/submissions
?student_ids[]=all&per_page=100‍

The response includes a while(1); at the beginning since we were not able to include the Accept: application/json header this way. The work around is to select and copy everything after the while(1); starting with, and including, the opening brace {. Then you can go paste that into a JSON to CSV converter.

Note that the API call that you're using is for ALL submissions in a course. This is the number of students times the number of assignments, so you will quickly run past the 100 limit on per_page. The API call that you're using is one of the few places that do NOT support the page= approach that Peter warned about. That means that you will definitely need to read up on pagination and you will need to take more advanced steps to use a browser.

If you use the API to fetch the grades for a single assignment, then there is a chance that the page= parameter will be supported. In this case, you could add a &page=2 to the querystring and get the second list.

What is it that you're trying to accomplish here? You can export the gradebook and get all of the grades directly from within Canvas, which is what most people are after with the API call you chose. Any substantial API work is going to require programming and you'll definitely want to join the Developer's group that Chris linked to on July 14.