diff --git a/examples/client.py b/examples/client.py index a9b86e4b312537f70530d3e92baf10a41c5f6907..9547350ec8cdb1dee597b05e32aeb4ba7c2f478f 100644 --- a/examples/client.py +++ b/examples/client.py @@ -13,11 +13,11 @@ query = ArchiveQuery( 'atoms': ['O'] }, required={ - 'section_run': { - 'section_single_configuration_calculation[0]': { + 'section_run[0]': { + 'section_single_configuration_calculation[-2]': { 'energy_total': '*' }, - 'section_system[0]': '*' + 'section_system[-2]': '*' } }, per_page=10, diff --git a/nomad/app/api/archive.py b/nomad/app/api/archive.py index c068130f228730643f8f51b7662280ba154865d0..9b937466061d3d23e4106e060e5a02e2d31b0b5d 100644 --- a/nomad/app/api/archive.py +++ b/nomad/app/api/archive.py @@ -217,7 +217,7 @@ _archive_query_model = api.inherit('ArchiveSearch', search_model, { 'query': fields.Nested(query_model, description='The query used to find the requested entries.', skip_none=True), 'required': fields.Raw(description='A dictionary that defines what archive data to retrive.'), 'query_schema': fields.Raw(description='Deprecated, use required instead.'), - 'raise_errors': fields.Boolean(description='Return 401 on missing archives or 500 on other errors instead of skipping the entry.') + 'raise_errors': fields.Boolean(description='Return 404 on missing archives or 500 on other errors instead of skipping the entry.') }) @@ -259,7 +259,7 @@ class ArchiveQueryResource(Resource): else: required = data_in.get('query_schema', '*') - raise_error = data_in.get('raise_error', True) + raise_errors = data_in.get('raise_errors', False) except Exception: abort(400, message='bad parameter types') @@ -328,15 +328,15 @@ class ArchiveQueryResource(Resource): except ArchiveQueryError as e: abort(400, str(e)) except KeyError: - if raise_error: - abort(401, 'Archive for entry %s does not exist' % calc_id) + if raise_errors: + abort(404, 'Archive for entry %s does not exist' % calc_id) # We simply skip this entry pass except Restricted: # TODO in reality this should not happen pass except Exception as e: - if raise_error: + if raise_errors: raise e common.logger(str(e), exc_info=e)