NERM APIs inconsistent behavior for zero results

Hi all, :slight_smile:

I have noticed inconsistencies amongst NERM APIs.

GET /api/user_managers results in 200 OK with error message: no managers found
GET /api/advanced_search results in 400 Bad Request with error message no advanced searches found (shouldn’t the endpoint here be called advanced_searches plural? That is what the documentation demands at least)
GET /api/identity_proofing_results results in 404 Not Found with error message no identity proofing results found

This is inconsistent behavior meaning we would need to change our scripts for each different object type.

I would like to suggest the following result when no objects exists:
It should result in 200 OK with empty array as response [].
Benefits:

  1. All object types behaving the same makes it more predictable and user friendly
  2. It should be 200 OK because the API could do what it should do: list all objects in an array. This can be an array with 10 objects, and array with 2 objects, and array with 1 object and an array with 0 objects. A 400 Bad Request error would suggest we gave the wrong input, which we didn’t. And 404 Not Found should be used in case we specifically refer to an object that does not exist, for example by calling GET /api/users/1234....56789.
  3. An empty array [], instead of a value such as null or ERROR will allow us call a length() or size() method on it to get 0 as result. In addition we would not need to perform unneeded edge case handling if we want to iterate over the results. For iterating over null or ERROR will go wrong, whereas iterating over [] will do exactly as expected: Perform 0 iterations.
  4. In addition, if the url parameter metadata=true was passed along, we would expect the _metadata in the body, even if there were no objects.

Kind regards,
Angelo