Revert "Change error responses to 404 in query API"

This reverts commit 1f3f8d1354444445a23c337be315252c156b9e01.

Per suggestion from will-moore, removing 404 responses from AJAX calls
and returning a dictionary with an error field instead.

This change was already merged into develop (PR 898), porting to dev_4_4.