The canvas LMS documents their REST API to query the canvas. It requires generating a token.
All their URLs are:
https://canvas.instructure.com/api/v1/
with authentication provided by a Bearer token.
After the base comes the request. I tried listing all courses available to me:
https://canvas.instructure.com/api/v1/courses
and it works.
The following link show how to get a list of users out of a particular course:
https://canvas.instructure.com/doc/api/courses.html#method.courses.users
The URL in the docs is stated as
GET /api/v1/courses/:course_id/users
In the previous query, I found ids of my course. The first field in each returned JSON was:
"id":69480000000243528
And I know from clicking on canvas courses, that this is the URL of a course:
https://school.instructure.com/courses/269039
The id then, is either the whole number, or just the last digits. I believe it's the whole number though I tried both. As I understand it then, I should compose a URL
https://canvas.instructure.com/api/v1/courses/69480000000243528/users
This doesn't fail, but it dumps a huge web page on me, and I don't understand why. It does talk about a "paged response" but what I would expect is the first list of 20 students, and somehow a way to get the next group. Here is the beginning of the returned page:
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<link rel="preload" href="https://du11hjcvx0uqb.cloudfront.net/dist/fonts/lato/extended/Lato-Regular-bd03a2cc27.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="https://du11hjcvx0uqb.cloudfront.net/dist/fonts/lato/extended/Lato-Bold-cccb897485.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="https://du11hjcvx0uqb.cloudfront.net/dist/fonts/lato/extended/Lato-Italic-4eb103b4d1.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="stylesheet" href="https://du11hjcvx0uqb.cloudfront.net/dist/brandable_css/no_variables/bundles/fonts-6ee09b0b2f.css" media="screen" />
<script>if (navigator.userAgent.match(/(MSIE|Trident\/)/)) location.replace('/ie-is-not-supported.html')</script>
<link rel="icon" type="image/x-icon" href="https://du11hjcvx0uqb.cloudfront.net/dist/images/favicon-e10d657a73.ico" />
<link rel="apple-touch-icon" href="https://du11hjcvx0uqb.cloudfront.net/dist/images/apple-touch-icon-585e5d997d.png" />
<link rel="stylesheet" href="https://du11hjcvx0uqb.cloudfront.net/dist/brandable_css/87dbc269d7511ace12f9ced6195f5bb6/variables-7dd4b80918af0e0218ec0229e4bd5873.css" media="all" />
<link rel="stylesheet" href="https://du11hjcvx0uqb.cloudfront.net/dist/brandable_css/new_styles_normal_contrast/bundles/common-4adb65b56a.css" media="all" />
<meta name="apple-itunes-app" content="app-id=480883488">
<link rel="manifest" href="/web-app-manifest/manifest.json">
In case it was some bizarre error I didn't understand, I tried just the end of the number:
https://canvas.instructure.com/api/v1/courses/243528/users
That didn't work either Can someone explain what this means? Is there no way to just get the data rather than a web page?