Source

audrid / audrid / views / api.py

Diff from to

File audrid/views/api.py

         return f(*args, **kwargs)
     return decorated_function
 
-@app.route('/api/v1/info', methods=['GET'])
-@authorization_required
+@app.route('/api/v1', methods=['GET'])
 def info(user=None):
-    return jsonify(info='Audrid API', version="1")
+    return jsonify(info='Audrid API', version="1", urls=[ [r.rule] + list(r.methods) for r in app.url_map.iter_rules() ])
+
+@app.route('/api/v1/documents', methods=['GET'])
+def documents_get_all():
+    try:
+        docs = Document.query.filter_by(deleted=False).all()
+        return jsonify(docs=[ d.as_dict() for d in docs ])
+    except Exception as exc:
+        return jsonify(message='storage error: %s' % exc), 500
 
 @app.route('/api/v1/pools', methods=['GET'])
 @authorization_required
         audit_dict = V.audit(json.loads(request.data))
     except Exception as exc:
         return jsonify(message='error during validation: %s' % exc), 400
+
     try:
         exam = Exam.query.filter_by(id=audit_dict['exam_id']).first_or_404()
         pool = Document.query.filter_by(id=exam.pool_id).first_or_404()
         app.logger.error(exc)
         return jsonify(message='storage error: %s' % exc), 400
     return jsonify(message='ok')
+