GraphQL
Last updated
Was this helpful?
Last updated
Was this helpful?
GraphQL is a query API language that executes queries by using a type system based on defined input data. GraphQL provides more specific inquiries with faster results and populate multiple inputs into one query.
Note: GraphQL endpoint permissions mirror permissions for the REST API. A user is only granted access to view grades based on that user’s permissions. For instance, a student cannot view grades for another student, but an instructor can view grades for any student in a course.
.
Canvas has included the tool , an in-browser graphical interface for interacting with GraphQL endpoints.
The GraphiQL interface can be viewed by adding /graphiql to the end of your Canvas production URL (e.g. your-institution.instructure.com/graphiql).
The /graphiql access can also be added to a test or beta environment URL. Requests from the selected environment will always return that environment’s data.
The Explorer sidebar displays all available queries and mutations. Any selected items display in the GraphiQL window. Once a query or mutation is selected, any values displayed in purple text identify the value as an input argument.
The Canvas REST API will continue to be available.
Fields are being added to the GraphQL API on an as-needed basis. The GraphQL
API does not include everything that is currently in the REST API. Feel free
to submit pull requests on github to add additional features or talk about it
in the #canvas-lms
channel on libera.chat.
All GraphQL queries are posted to this endpoint.
query
string
the GraphQL query to execute
variables
Hash
variable values as required by the supplied query
id
vs _id
and the node
fieldMost objects can be fetched by passing their GraphQL id
to thenode
field:
A legacyNode
field is also available to fetch objects via the
REST-style ids:
For commonly accessed object types, type-specific fields are provided:
The Canvas LMS GraphQL API follows the .
Querying for an object's id
will return a global identifier instead of the
numeric ids that are used in the REST API. The traditional ids can be queried
by requesting the _id
field.
Canvas follows the for paginating collections. Request reasonable page sizes to avoid being limited.
This documentation is generated directly from the Canvas LMS source code, available .