Convert to Graphql
titaniumbones opened this issue · 0 comments
Canvas has an "experimental" graphql endpoint which is dramatically faster & allows much more complex queries. Documentation is much sparser than in the REST API, and it's uncleatr which parts of the API are supported, but, a very quick investigation at the U of T online test point shows that it should, e.g., be possible to submit all student marks for a given assignment in a single query, a dramatic speedup. Submissions are also accessible this way, though since they are stored off-site on AWS the speedup may not be as noticeable, and the access is buried pretty deep i n the assignments.
Not an urgent need, but a significant improvement & worth following up on. Here are some sample queries from the API:
All Courses
query MyQuery {
allCourses {
id
courseCode
}
}
All Assignments
query MyQuery {
course(id: "Q291cnNlLTY0NzA2") {
name
term {
id
}
courseCode
assignmentsConnection {
edges {
node {
name
hasSubmittedSubmissions
submissionsConnection {
edges {
node {
id
body
attachments {
updatedAt
id
}
}
}
nodes {
id
}
}
}
}
}
}
}
Clumsy all submissions
query MyQuery {
course(id: "Q291cnNlLTY0NzA2") {
name
term {
id
}
courseCode
assignmentsConnection {
edges {
node {
name
hasSubmittedSubmissions
submissionsConnection {
edges {
node {
id
}
}
nodes {
id
}
}
}
}
}
}
}
Submissions Ids
query MyQuery {
course(id: "Q291cnNlLTY0NzA2") {
name
term {
id
}
courseCode
assignmentsConnection {
edges {
node {
name
hasSubmittedSubmissions
submissionsConnection {
edges {
node {
id
body
attachments {
updatedAt
id
}
}
}
nodes {
id
}
}
}
}
}
}
}