David Haines

Getting all valid information from an API query

Discussion created by David Haines on Apr 6, 2016

We've been planning to use an API query to end up getting assignments for a user in this format:



This was working fine until we ran across a student with an 'inactive' status in a course.  They don't have access to those events any longer so we wouldn't expect data for that course but all we get back from the query is a permission error.  Valid information for the other courses is not returned and the error message isn't sufficient to narrow down what exactly caused the problem.  There are certainly ways to work around this.  Our strategy now is to add some code to ask for the information one course at a time so that a failure for one class won't impact data from another class.  We could also add status tracking code to avoid asking for class data for an inactive student.  However I suggest that the API would be easier to use if the API users could expect to get back any valid information from a query and not have that information thrown away because of an unrelated error.  We'd be quite happy to get back a list like [[assignments for course A], [assignments for course B], [PERMISSION ERROR for course C],[assignments for course D]]


I'm interested in other people's reactions to this suggestion.