Graphql vs. REST API - assignment submissions data

almyers
Community Member

Hello,

To start, my questions for the following Scenario are:

1. Am I missing a graphql endpoint that can tell me who an assignment has been assigned to instead of using the submissionsConnection?

2. I know that the graph API is built differently than the REST - but I don't know enough to know if this is a bug or whether it's worth creating an issue in github for? 

Scenario:

I have used the REST API to get submission information for canvas assignments. This returns a record for every user who has been assigned that assignment, and of importance, a record even when that student has not submitted an assignment. I use the API call https://canvas.ubc.ca/api/v1/courses/COURSEID/assignments/ASSIGNMENTID/submissions

Let's say I have a 5 student course, and only 2 submitted an assignment. I would still get 5 submission records, with 3 records where "missing: true".

However, this does not seem to be the case for graphql. 

Here is a subset of my query: 

 assignmentsConnection {
nodes {
_id
allowedAttempts
dueAt
expectsSubmission
name
pointsPossible
submissionTypes
submissionsConnection {
nodes {
_id
attempt
missing
submissionStatus
submissionType
user {
_id
}
}
}

I would expect to get 5 submissionConnection nodes, with 3 having values of "missing": true. However, in this case I would only have 2 records returned (for cases where students did submit an assignment). 

The main reason why I would want full records (even for non-submitted assignments) is that it is impossible to tell the difference between an assignment that was not assigned to vs not submitted by particular students. The REST API returns only students who have been assigned that assessment, but the graph API returns only students who have submitted the assignment.

 

 

Labels (2)
0 Likes