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.
Merge pull request #1007 from knabar/dev_4_4

Revert "Change error responses to 404 in query API"