Defenestration
New Member

New Analytics API endpoint for requesting Course Activity Report

Hi,

I would like to perform custom analytics on the Course activity report.csv file that is generated within the New Analytics tool.

I am trying to figure out how to make a call to the graphQL api to download the report because I want to run it in a cronjob.

I know that the api resides in the link below but I haven't been able to find any documentation to help me figure out a working example. I am familiar with the REST API but didn't see anything about this there either.

https://canvas-analytics-iad-prod.inscloudgate.net/v2/graphql 

 

Thanks for your help!

 

0 Kudos
4 Replies
afromero2
Community Participant

Hi @Defenestration,

Is there a way to get information from New Analytics endpoints?

Is there an API? (catalog of endpoints. Example: https://canvas.instructure.com/doc/api/)

@James Do you know something about this?

Regards.

0 Kudos
James
Community Champion

@afromero2 

I have not found a documented API list, but then I haven't looked too hard either. Most of what I need from new analytics can be found in old analytics (and be up to date) or by querying the GraphQL query that New Analytics makes.

The easiest way would probably be to turn on the developer tools, switch to the network tab, select just XHR/fetch and then load new analytics. There are a series of graphql that are made at the beginning (I count 6). The problem is that the authorization is done through a session-id that is set up during the handshake process of connecting.

Canvas has said, in their push to get everyone to use GraphQL, that it's better to use the proxy because their remote sites can be accessed that way rather than having to use a different authentication for each one. I have not looked into this to see if the analytics data is hooked to that or not. In fact, I didn't see any documentation about how to use the proxy, so I'm hoping it's just somewhere I haven't found.

Clicking the download button doesn't download any additional data via graphql statements, so it looks like it compiles in the browser what it has already downloaded rather than having a call to generate a report (I might be looking at the wrong report).

 

James
Community Champion

@afromero2 

I dug deeper into the graphql proxy that Canvas recommends. I got far enough to see that they are trying to deliver some kind of schema that could allow people to query the services, but there is a potential problem with their setup.

There are DOCS and SCHEMA buttons on the right hand side of the playground, but I keep getting 400 server errors when I load the page (401 errors if not authorized). When I copied the query that they were sending that was generating the error, it came back with an error message of "GraphQL introspection is not allowed by Apollo Server, but the query contained __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production"

Since it doesn't work in production, I tried beta and test. The DOCS and SCHEMA do work in both the beta and test instances though (you do have to add the authorization header first). That sort of defeats the purpose of getting real, up-to-date information from the proxy, but hopefully you can use the beta instance to get the query and then execute it on the production server. There are some things about New Quizzes and lots of things about Quiz (which I'm supposing is New Quizzes since it mentions stimulus), but I didn't dig into those further than to see that the concern we had about lack of documentation with graphQL is very much present. The documentation approach appears to be that the schema should be self-documenting and you should know what all of those things mean from their names.

Back to this question. When I search for analytics in the docs, the only thing that comes up is StudentSummaryAnalytics, CoursePermissions.viewAnalytics, and User.summaryAnalytics.

The StudentSummaryAnalytics description is "basic information about a students activity in a course" and it provides pageViews, participations, and tardinessBreakdown. These are the same options that are available in the graphQL for a production instance or the Get course-level student summary data endpoint from the REST API, and not anything specific to the separate server that you call for New Analytics.

As for the proxy being the one-stop shop for all data, it's definitely not there yet. I didn't see anything on Canvas Studio, New Analytics, Roll Call Attendance. Really I didn't see much of anything except for Canvas and New Quizzes and some miscellaneous things like hello and whoami.

Defenestration
New Member

Thanks for checking so thoroughly @James

The information I need is only available in the new analytics so this sadly looks like a dead end. 

For those that are interested, I think it should be possible to create a Selenium script to grab the data via the GUI download link.