AnsweredAssumed Answered

Can't seem to get Canvas LMS REST API working :(

Question asked by Verun Rahimtoola on Jul 8, 2018
Latest reply on Jul 12, 2018 by James Jones

I've set up a virtual machine with Ubuntu and I have a Canvas installation on it that's working. I've been able to create a course, add assignments and students to it. Within the virtual machine I'm able to access it at http://localhost:3000 in my browser.

 

I also set up Cassandra + Redis, enabled rpc and ran rake db:migrate and it ran fine.

 

However, I can't seem to get the analytics REST APIs working, using the access token I've generated for the admin account. For instance, when I run the following from the command line:

 

curl http://localhost:3000/api/v1/courses -H 'Authorization: Bearer <token>'

I just get back an empty list ([]). This is probably because the admin user is not part of any courses.
However, when I append 'as_user_id' like so:

curl http://localhost:3000/api/v1/courses?as_user_id=10000000002 -H 'Authorization: Bearer <token>'
Then it works and returns the courses for that user ID.

However, when I try the following:

curl http://localhost:3000/api/v1/courses/1/analytics/activity?as_user_id=10000000002 -H 'Authorization: Bearer <token>'
I get the following HTML error:

No route matches [GET]: /api/v1/courses/1/analytics/activity.

Any idea what I'm doin wrong? I'm confused about when to specify the as_user_id parameter and when to leave it out.

Is there not a way to have a superuser-type access token that will let you access all analytics?

 

Outcomes