{"action":"closed","issue":{"url":"https://api.github.com/repos/alerta/alerta/issues/570","repository_url":"https://api.github.com/repos/alerta/alerta","labels_url":"https://api.github.com/repos/alerta/alerta/issues/570/labels{/name}","comments_url":"https://api.github.com/repos/alerta/alerta/issues/570/comments","events_url":"https://api.github.com/repos/alerta/alerta/issues/570/events","html_url":"https://github.com/alerta/alerta/issues/570","id":340182463,"node_id":"MDU6SXNzdWUzNDAxODI0NjM=","number":570,"title":"Mongo style query using 'q' parameter doesn't work","user":{"login":"mehertz","id":3106180,"node_id":"MDQ6VXNlcjMxMDYxODA=","avatar_url":"https://avatars2.githubusercontent.com/u/3106180?v=4","gravatar_id":"","url":"https://api.github.com/users/mehertz","html_url":"https://github.com/mehertz","followers_url":"https://api.github.com/users/mehertz/followers","following_url":"https://api.github.com/users/mehertz/following{/other_user}","gists_url":"https://api.github.com/users/mehertz/gists{/gist_id}","starred_url":"https://api.github.com/users/mehertz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehertz/subscriptions","organizations_url":"https://api.github.com/users/mehertz/orgs","repos_url":"https://api.github.com/users/mehertz/repos","events_url":"https://api.github.com/users/mehertz/events{/privacy}","received_events_url":"https://api.github.com/users/mehertz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-11T10:25:52Z","updated_at":"2018-07-12T18:01:30Z","closed_at":"2018-07-12T18:01:30Z","author_association":"CONTRIBUTOR","body":"Hi,\r\n\r\nI've been trying to use the `q` parameter as described here:\r\nhttp://alerta.readthedocs.io/en/latest/api/reference.html#search-alerts\r\n\r\nUnfortunately it doesn't seem to work. I get the following error (reqeust is `/api/alerts?q=awd`):\r\n```\r\n{\r\n  \"code\": 500, \r\n  \"errors\": [\r\n    \"Traceback (most recent call last):\\n  File \\\"/usr/lib/python2.7/site-packages/flask/app.py\\\", line 1612, in full_dispatch_request\\n    rv = self.dispatch_request()\\n  File \\\"/usr/lib/python2.7/site-packages/flask/app.py\\\", line 1598, in dispatch_request\\n    return self.view_functions[rule.endpoint](**req.view_args)\\n  File \\\"/usr/lib/python2.7/site-packages/flask_cors/decorator.py\\\", line 128, in wrapped_function\\n    resp = make_response(f(*args, **kwargs))\\n  File \\\"/usr/lib/python2.7/site-packages/alerta/auth/utils.py\\\", line 118, in wrapped\\n    return f(*args, **kwargs)\\n  File \\\"/usr/lib/python2.7/site-packages/alerta/models/metrics.py\\\", line 259, in wrapped\\n    response = f(*args, **kwargs)\\n  File \\\"/usr/lib/python2.7/site-packages/alerta/utils/api.py\\\", line 28, in decorated\\n    return func(*args, **kwargs)\\n  File \\\"/usr/lib/python2.7/site-packages/alerta/views/alerts.py\\\", line 199, in search_alerts\\n    query = qb.from_params(request.args, query_time)\\n  File \\\"/usr/lib/python2.7/site-packages/alerta/database/backends/mongodb/utils.py\\\", line 23, in from_params\\n    query = json.loads(params.pop('q'))\\n  File \\\"/usr/lib/python2.7/site-packages/werkzeug/datastructures.py\\\", line 179, in pop\\n    is_immutable(self)\\n  File \\\"/usr/lib/python2.7/site-packages/werkzeug/datastructures.py\\\", line 29, in is_immutable\\n    raise TypeError('%r objects are immutable' % self.__class__.__name__)\\nTypeError: 'ImmutableMultiDict' objects are immutable\\n\"\r\n  ], \r\n  \"message\": \"'ImmutableMultiDict' objects are immutable\", \r\n  \"status\": \"error\"\r\n}\r\n```\r\n\r\nThe line where the exception is thrown is:\r\nhttps://github.com/alerta/alerta/blob/master/alerta/database/backends/mongodb/utils.py#L23\r\n\r\nThe actual value of `q` is irrelevant. I've just tested against the latest version of alerta on pip and it's the same issue. Any ideas?\r\n\r\nThanks,\r\n\r\nMatthew"}}
{"actor":{"display_login":"satterly"}}