7 ms·
Does “GET /students” return all the students in the system? Probably not. So in fact you’re fetching some subset of students anyway, and the size of the return
by pavlov 3y ago
Does “GET /students” return all the students in the system? Probably not.
So in fact you’re fetching some subset of students anyway, and the size of the returned set might be one or zero depending on your query.
Given that, “GET /student” seems just as meaningful because neither the singular nor the plural can fix the ambiguity about what you’re actually getting.
- stickfigure 3y agoYes, I would expect GET /students to return all of the students (or at least, all of the students visible to me). Typically with query parameters for filtering: GET /students?min_age=20 Alternatively, `students` might be a collection attribute on another resource: GET /classes/{class_id}/students
- zdragnar 3y agoI expect singular to return one, and plural to return a set, which could range from 0...n. Likewise, I wouldn't expect a singular to return a single object wrapped in an array, but I would always expect "/plural" (with no further qualifier in the url) to return an array, regardless of 0, 1 or more results. Why would returning a full set be a condition of whether or not plural is ambiguous?