diff --git a/SE_API/ProjectRoutes.py b/SE_API/ProjectRoutes.py index 0056c9a..a66ed58 100644 --- a/SE_API/ProjectRoutes.py +++ b/SE_API/ProjectRoutes.py @@ -216,6 +216,55 @@ def getProjectsByCourse(token, courseId): mimetype="application/json") +@project_routes.route('/api/projects/getProjectsById//', methods=["GET"]) +@auto.doc() +def getProjectsById(token, projectId): + """ + >This Call will return an array of all projects in a given course +
+ Route Parameters
+ - seToken: token
+ - projectId: 1234567890 +
+
+ Payload
+ - NONE +
+
+ Response +
+ 200 - JSON Example:
+ + {
+ 'projectName': 'Advance Math',
+ 'courseId': 123456789,
+ 'grade': 98,
+ 'logo_url': 'http://location.domain.com/image.jpg',
+ 'gitRepository': 'repoOwner/repoName',
+ 'membersId': ['bob', 'dylan', 'quentin', 'terentino'],
+ 'id' : 1234567890
+ } +
+
+ """ + + if get_user_by_token(token) is None: + return bad_request("Bad User Token") + + try: + project = Project.get_by_id(int(projectId)) + except Exception as e: + print e + return bad_request("Bad Id Format") + + if project is None: + return bad_request("No such Project") + + return Response(response=project.to_JSON(), + status=200, + mimetype="application/json") + + @project_routes.route('/api/projects/getProjectsByUser/', methods=["GET"]) @auto.doc()