Experimental GraphQL API?

Jump to solution
dgrobani
Community Champion

While reviewing our Feature Options today, I was excited to notice for the first time one called "GraphQL API." It's marked beta and described as "EXPERIMENTAL GraphQL API."

I know about GraphQL but couldn't find any info at all on its use in Canvas. Has anyone heard anything about this? Thanks!

1 Solution

Hi --

I finally had some time to update our local Canvas instance with the latest code from GitHub and I've spent a little time poking at the graphql API.  First, there's a browser-based graphql console (GraphiQL) that is installed along with Canvas, but seems to only be available to users with administrator privileges on the "Site Admin" account (we have access to this in our locally-hosted development instance of Canvas, but not in our Instructure-hosted instances). The actual graphql API endpoint (/api/graphql) is accessible by regular users in our local instance. 

Here's an example of a query that I managed to get to work, sent as the body of a POST request to /api/graphql:

{"query": "
  {
    allCourses {
      id,
      name,
      courseCode,
      state
    }
  }
"}

That returns a data structure with information about the courses that are on the user's dashboard.  Still trying to figure out how to drill down into sections, etc...

--Colin

View solution in original post