From 26c66842b4b409978eac2cc594816ef4036729dc Mon Sep 17 00:00:00 2001 From: aranzaiger Date: Mon, 15 Jun 2015 16:54:12 +0300 Subject: [PATCH] added getCourseByCampusName function --- SE_API/CourseRoutes.py | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/SE_API/CourseRoutes.py b/SE_API/CourseRoutes.py index 6b76f3b..4131674 100644 --- a/SE_API/CourseRoutes.py +++ b/SE_API/CourseRoutes.py @@ -83,6 +83,49 @@ def create_course(token): +@course_routes.route('/api/courses/getCourseByCampusName/', methods=["GET"]) +@auto.doc() +def getCourseByCampusName(name): + ''' + This Function is will Activate a user and add tha campus to it +
+ Route Parameters
+ - validation_token: 'seToken|email_suffix' +
+
+ Payload
+ - NONE +
+
+ Response +
+ 200 - JSON Example:
+ + {
+ 'username' : 'github_username',
+ 'name' : 'Bob Dylan',
+ 'email' : 'email@domain.com',
+ 'isLecturer' : true,
+ 'seToken' : 'dds2d-sfvvsf-qqq-fdf33-sfaa',
+ 'avatar_url' : 'http://location.domain.com/image.jpg',
+ 'isFirstLogin' : false,
+ 'campuses_id_list': ['22314','243512',...,'356'],
+ 'classes_id_list': ['22314','243512',...,'356']
+ } +
+
+ 403 - Invalid Token + ''' + query = Course.all() + query.filter("title = ", name) + + for c in query.run(limit=5): + return Response(response=c.key().id(), + status=200, + mimetype="application/json") # Real response! + + return bad_request("No Campus Found") + @course_routes.route('/api/courses/help') def documentation(): return auto.html() \ No newline at end of file