'Retrieve a query.
:param query_id: ID of query to fetch
Responds with the :ref:`query <query-response-label>` contents.'

@require_permission('view_query')
def get(self, query_id):

    q = get_object_or_404(models.Query.get_by_id_and_org, query_id, self.current_org)
    require_access(q.groups, self.current_user, view_only)
    result = q.to_dict(with_visualizations=True)
    result['can_edit'] = can_modify(q, self.current_user)
    return result
