8 | | == Resources == |
9 | | |
10 | | === Users === |
11 | | |
12 | | ||GET||/v1/users||get a list of users|| |
13 | | || ||parameter||none|| |
14 | | || ||input||none|| |
15 | | || ||status (success)||HTTP/1.1 200 OK|| |
16 | | || ||output (success)||[{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"id":"USER1_ID","role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}]|| |
17 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
18 | | || ||output (failure)||none|| |
19 | | ||GET||/v1/users/{id}||get a user with id|| |
20 | | || ||parameter||USER_ID|| |
21 | | || ||input||none|| |
22 | | || ||status (success)||HTTP/1.1 200 OK|| |
23 | | || ||output (success)||{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
24 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
25 | | || ||output (failure)||none|| |
26 | | ||POST||/v1/users||create a user|| |
27 | | || ||parameter||none|| |
28 | | || ||input||{"role_id":"ROLE_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
29 | | || ||status (success)||HTTP/1.1 201 CREATED|| |
30 | | || ||output (success)||{"id":"USER_ID","role_id":"ROLE_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
31 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
32 | | || ||output (failure)||none|| |
33 | | ||POST||/v1/users||create users|| |
34 | | || ||parameter||none|| |
35 | | || ||input||{"role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
36 | | || ||status (success)||HTTP/1.1 201 CREATED|| |
37 | | || ||output (success)||{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"id":"USER1_ID","role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
38 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
39 | | || ||output (failure)||none|| |
40 | | ||DELETE||/v1/users/{id}||remove a user with id|| |
41 | | || ||parameter||USER_ID|| |
42 | | || ||input||none|| |
43 | | || ||status (success)||HTTP/1.1 204 No Content|| |
44 | | || ||output (success)||none|| |
45 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
46 | | || ||output (failure)||none|| |
47 | | ||PUT||/v1/users/{id}||update a user with id|| |
48 | | || ||parameter||COURSE_ID|| |
49 | | || ||input||{"id":"USER_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME","role_id":"ROLE_ID"}|| |
50 | | || ||status (success)||HTTP/1.1 200 OK|| |
51 | | || ||output (success)||{"id":"USER_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME","role_id":"ROLE_ID"}|| |
52 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
53 | | || ||output (failure)||none|| |
54 | | |
55 | | === Courses === |
56 | | |
57 | | ||GET||/v1/courses||get a list of courses for current logged in user|| |
58 | | || ||parameter||none|| |
59 | | || ||input||none|| |
60 | | || ||status (success)||HTTP/1.1 200 OK|| |
61 | | || ||output (success)||[{"id":"COURSE0_ID","course":"COURSE0_CODE","title":"COURSE0_TITLE"},{"id":"COURSE1_ID","course":"COURSE1_CODE","title":"COURSE1_TITLE"}]|| |
62 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
63 | | || ||output (failure)||No courses can be found|| |
64 | | ||GET||/v1/courses/{id}||get a course with id|| |
65 | | || ||parameter||COURSE_ID|| |
66 | | || ||input||none|| |
67 | | || ||status (success)||HTTP/1.1 200 OK|| |
68 | | || ||output (success)||{"id":"COURSE_ID","course":"COURSE_CODE","title":"COURSE_TITLE"}|| |
69 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
70 | | || ||status (failure)||No course with id COURSE_ID can be found|| |
71 | | ||POST||/v1/courses||create a course|| |
72 | | || ||parameter||none|| |
73 | | || ||input||{"Course":{"course":"COURSE_CODE","title":"COURSE_TITLE"},"Department":{"Department":[DEPARTMENT_ID]}}|| |
74 | | || ||status (success)||HTTP/1.1 201 Created|| |
75 | | || ||output (success)||COURSE_ID|| |
76 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
77 | | || ||output (failure)||Error: the course was not added|| |
78 | | ||DELETE||/v1/courses/{id}||remove a course with id|| |
79 | | || ||parameter||COURSE_ID|| |
80 | | || ||input||none|| |
81 | | || ||status (success)||HTTP/1.1 204 No Content|| |
82 | | || ||output (success)||COURSE_ID|| |
83 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
84 | | || ||output (failure)||Error: the course was not deleted|| |
85 | | ||PUT||/v1/courses/{id}||update a course with id|| |
86 | | || ||parameter||none|| |
87 | | || ||input||{"Course":{"id":"COURSE_ID","course":"COURSE_CODE","title":"COURSE_TITLE"}}|| |
88 | | || ||status (success)||HTTP/1.1 200 OK|| |
89 | | || ||output (success)||COURSE_ID|| |
90 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
91 | | || ||output (failure)||Error: the course was not edited|| |
92 | | |
93 | | === !Courses/Users === |
94 | | |
95 | | ||GET||/v1/courses/{course_id}/users||get a list of users associated within the course {course_id}|| |
96 | | || ||parameter||COURSE_ID|| |
97 | | || ||input|| none |
98 | | || ||status (success)||HTTP/1.1 201 Created|| |
99 | | || ||output (success)||[{"id": "1", "username":"username1", "role_id":1}, {"id": "2", "username":"username2", "role_id":1},{"id": "3", "username":"username3", "role_id":2}]|| |
100 | | || ||status (failure)||HTTP/1.1 400 Unrecognizable Request|| |
101 | | || ||output (failure)|| none || |
102 | | ||POST||/v1/courses{course_id}/users||associate users to the course by {course_id}|| |
103 | | || ||parameter||COURSE_ID|| |
104 | | || ||input||[{"username":"username1", "role_id":5}, {"username":"username2", "role_id":5},{"username":"username3", "role_id":4}], other fields in request will be ignored|| |
105 | | || ||status (success)||HTTP/1.1 200 OK|| |
106 | | || ||output (success)||[{"username":"username1", "role_id":5}, {"username":"username2", "role_id":5},{"username":"username3", "role_id":4}]|| |
107 | | || ||status (failure)||HTTP/1.1 501 Unsupported role for {username}|| |
108 | | || ||note (failure)|| The role_id was unrecognized, recognized role_ids right now are student (5), tutor (4), and instructor (3) || |
109 | | || ||status (failure)||HTTP/1.1 501 Fail to enrol {username}|| |
110 | | || ||note (failure)|| Tried to save the new enrolments but failed due to a database error. || |
111 | | ||DELETE||/v1/courses/{course_id}/users||remove a user from the course|| |
112 | | || ||parameter||COURSE_ID|| |
113 | | || ||input||[{"username":"username1", "role_id":5}, {"username":"username2", "role_id":5},{"username":"username3", "role_id":4}], other fields in request will be ignored|| |
114 | | || ||status (success)||HTTP/1.1 200 OK|| |
115 | | || ||output (success)||[{"username":"username1", "role_id":5}, {"username":"username2", "role_id":5},{"username":"username3", "role_id":4}]|| |
116 | | || ||status (failure)||HTTP/1.1 501 Unsupported role for {username}|| |
117 | | || ||note (failure)|| The role_id was unrecognized, recognized role_ids right now are student (5), tutor (4), and instructor (3) || |
118 | | || ||status (failure)||HTTP/1.1 501 Fail to drop {username}|| |
119 | | || ||note (failure)|| Tried to save the new enrolments but failed due to a database error. || |
120 | | |
121 | | === !Courses/Departments === |
122 | | |
123 | | ||POST||/v1/courses/{course_id}/departments/{department_id}||add a course to a department|| |
124 | | || ||parameter||DEPARTMENT_ID|| |
125 | | || ||parameter||COURSE_ID|| |
126 | | || ||status (success)||HTTP/1.1 201 Created|| |
127 | | || ||output (success)||{"course_id":"COURSE_ID", "department_id":"DEPARTMENT_ID"}|| |
128 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
129 | | || ||output (failure)||none|| |
130 | | ||DELETE||/v1/courses/{course_id}departments/{department_id}/||delete a course from a department|| |
131 | | || ||parameter||DEPARTMENT_ID|| |
132 | | || ||parameter||COURSE_ID|| |
133 | | || ||status (success)||HTTP/1.1 204 No Content|| |
134 | | || ||output (success)||none|| |
135 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
136 | | || ||output (failure)||none|| |
137 | | |
138 | | === Departments === |
139 | | |
140 | | ||GET||v1/departments||get a list of departments the user has access to|| |
141 | | || ||parameter||none|| |
142 | | || ||status (success)||HTTP/1.1 200 OK|| |
143 | | || ||output (success)||[{"id":"DEPT_ID0","name":"DEPT_NAME0"},{"id":"DEPT_ID1","name":"DEPT_NAME1"}]|| |
144 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
145 | | || ||output (failure)||none|| |
146 | | ||GET||v1/departments/{department_id}||gets a list of courses that belongs to the department with DEPARTMENT_ID|| |
147 | | || ||parameter||DEPARTMENT_ID|| |
148 | | || ||status (success)||HTTP/1.1 200 OK|| |
149 | | || ||output (success)||[{"id":"COURSE0_ID","course":"COURSE0_CODE","title":"COURSE0_TITLE"},{"id":"COURSE1_ID","course":"COURSE1_CODE","title":"COURSE1_TITLE"}]|| |
150 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
151 | | || ||output (failure)||none|| |
152 | | |
153 | | === Groups === |
154 | | |
155 | | ||GET||/v1/courses/{course_id}/groups||get a list of groups in course {course_id}|| |
156 | | || ||parameter||COURSE_ID|| |
157 | | || ||input||none|| |
158 | | || ||status (success)||HTTP/1.1 200 OK|| |
159 | | || ||output (success)||[{"id":"GROUP_IDO","group_num":"GROUP_NUM0","group_name":"GROUP_NAME0","course_id":"COURSE_ID"},{"id":"GROUP_ID1","group_num":"GROUP_NUM1","group_name":"GROUP_NAME1","course_id":"COURSE_ID"}], or [] if there is no group|| |
160 | | || ||status (failure)||HTTP/1.1 500 Internal Error|| |
161 | | || ||output (failure)||none|| |
162 | | ||GET||/v1/courses/{course_id}/groups/id||get a group in course by group id, course_id will be ignored|| |
163 | | || ||parameter||COURSE_ID|| |
164 | | || ||parameter||GROUP_ID|| |
165 | | || ||status (success)||HTTP/1.1 200 OK|| |
166 | | || ||output (success)||{"id":"GROUP_ID","group_num":"GROUP_NUM","group_name":"GROUP_NAME","course_id":"COURSE_ID"}|| |
167 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
168 | | || ||output (failure)||none|| |
169 | | ||POST||/v1/courses/{course_id}/groups||create a group in course {course_id}|| |
170 | | || ||parameter||COURSE_ID|| |
171 | | || ||input||{"group_num":"GROUP_NUM","group_name":"GROUP_NAME","course_id":"COURSE_ID"}|| |
172 | | || ||status (success)||HTTP/1.1 201 Created|| |
173 | | || ||output (success)||{"id":"GROUP_ID","group_num":"GROUP_NUM","group_name":"GROUP_NAME","course_id":"COURSE_ID"}|| |
174 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
175 | | || ||output (failure)||none|| |
176 | | ||DELETE||/v1/courses/{course_id}/groups/{id}||remove a group in course by group id, course_id will be ignored|| |
177 | | || ||parameter||COURSE_ID|| |
178 | | || ||parameter||GROUP_ID|| |
179 | | || ||status (success)||HTTP/1.1 204 No Content|| |
180 | | || ||output (success)||none|| |
181 | | || ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
182 | | || ||output (failure)||none|| |
183 | | ||PUT||/v1/courses/{course_id}/groups/{id}||update a group in course by group id, course_id will be ignored|| |
184 | | || ||parameter||COURSE_ID|| |
185 | | || ||parameter||GROUP_ID|| |
186 | | || ||input||{"id":"GROUP_ID","course_id":"COURSE_ID","group_num":"GROUP_NUM","group_name":"GROUP_NAME"}|| |
187 | | || ||status (success)||HTTP/1.1 200 OK|| |
188 | | || ||output (success)||{"id":"GROUP_ID","group_num":"GROUP_NUM","group_name":"GROUP_NAME","course_id":"COURSE_ID"}|| |
189 | | || ||status (failure)||HTTP/1.1 200 OK|| |
190 | | || ||output (failure)||none|| |
191 | | |
192 | | === !Groups/Users === |
193 | | |
194 | | ||GET||/v1/groups/{group_id}/users||get a list of users associated within the group {group_id}|| |
195 | | ||POST||/v1/groups{group_id}/users||associate users to the group by {group_id}|| |
196 | | ||DELETE||/v1/groups/{group_id}/users/{user_id}||remove a user from the group|| |
197 | | || ||parameter||GROUP_ID|| |
198 | | || ||parameter||USER_ID|| |
199 | | || ||status (success)||HTTP/1.1 204 No Content|| |
200 | | || ||output (success)||none|| |
201 | | || ||status (failure)||HTTP/1.1 500 users were not deleted|| |
202 | | || ||output (failure)|| none || |
203 | | |
204 | | === Grades === |
205 | | |
206 | | ||GET||/v1/events/{event_id}/grades||get a list of grades in event {event_id}|| |
207 | | || ||parameter||EVENT_ID|| |
208 | | || ||status (success)||HTTP/1.1 200 OK|| |
209 | | || ||output (success)||[{"evaluatee":"EVALUATEE_ID","score":"SCORE"},{"evaluatee":"EVALUATEE_ID","score":"SCORE"}]|| |
210 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
211 | | || ||output (failure)||none|| |
212 | | ||GET||/v1/events/{event_id}/grades/{user_id}||get a grades for a user with {user_id} in the event {event_id}|| |
213 | | || ||parameter||EVENT_ID|| |
214 | | || ||parameter||USER_ID|| |
215 | | || ||status (success)||HTTP/1.1 200 OK|| |
216 | | || ||output (success)||{"evaluatee":"USER_ID","score":"SCORE"} |
217 | | || ||status (failure)||HTTP/1.1 404 Not Found|| |
218 | | || ||output (failure)||none|| |
| 10 | = Responses & Status Code = |
| 11 | The API attempts to return appropriate HTTP status codes for every request. |
| 12 | |
| 13 | Status Code: |
| 14 | || Code || Text || Description || |
| 15 | || 200 || OK || Success || |
| 16 | || 201 || Created || Resource has been created || |
| 17 | || 404 || Not Found || Resource is not found || |
| 18 | || 500 || Internal Server Error || Something is broken || |
| 19 | |
| 20 | If querying a collection and there is nothing in the collection, an empty array will be return. |
| 21 | In JSON, it will be "[]". |
| 22 | |
| 23 | |
| 24 | = Resources = |
| 25 | |
| 26 | == Users == |
| 27 | |
| 28 | === Get List of Users === |
| 29 | GET /v1/users |
| 30 | ||Return (success)||[{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"id":"USER1_ID","role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}]|| |
| 31 | |
| 32 | === Get a User with ID === |
| 33 | GET /v1/users/{id} |
| 34 | |
| 35 | ||parameter||USER_ID|| |
| 36 | ||output (success)||{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
| 37 | |
| 38 | === Create a User === |
| 39 | POST /v1/users |
| 40 | ||parameter||none|| |
| 41 | ||input||{"role_id":"ROLE_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
| 42 | ||status (success)||HTTP/1.1 201 CREATED|| |
| 43 | ||output (success)||{"id":"USER_ID","role_id":"ROLE_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
| 44 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 45 | ||output (failure)||none|| |
| 46 | |
| 47 | === Create Users === |
| 48 | POST /v1/users |
| 49 | ||parameter||none|| |
| 50 | ||input||{"role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
| 51 | ||status (success)||HTTP/1.1 201 CREATED|| |
| 52 | ||output (success)||{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"id":"USER1_ID","role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}|| |
| 53 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 54 | ||output (failure)||none|| |
| 55 | |
| 56 | === Remove a user with id === |
| 57 | DELETE /v1/users/{id} |
| 58 | ||parameter||USER_ID|| |
| 59 | ||input||none|| |
| 60 | ||status (success)||HTTP/1.1 204 No Content|| |
| 61 | ||output (success)||none|| |
| 62 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 63 | ||output (failure)||none|| |
| 64 | |
| 65 | === Update a user with id === |
| 66 | PUT /v1/users/{id} |
| 67 | ||parameter||COURSE_ID|| |
| 68 | ||input||{"id":"USER_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME","role_id":"ROLE_ID"}|| |
| 69 | ||status (success)||HTTP/1.1 200 OK|| |
| 70 | ||output (success)||{"id":"USER_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME","role_id":"ROLE_ID"}|| |
| 71 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 72 | ||output (failure)||none|| |
| 73 | |
| 74 | == Courses == |
| 75 | |
| 76 | === Get a list of courses for current logged in user === |
| 77 | GET /v1/courses |
| 78 | ||parameter||none|| |
| 79 | ||input||none|| |
| 80 | ||status (success)||HTTP/1.1 200 OK|| |
| 81 | ||output (success)||[{"id":"COURSE0_ID","course":"COURSE0_CODE","title":"COURSE0_TITLE"},{"id":"COURSE1_ID","course":"COURSE1_CODE","title":"COURSE1_TITLE"}]|| |
| 82 | ||status (failure)||HTTP/1.1 404 Not Found|| |
| 83 | ||output (failure)||No courses can be found|| |
| 84 | |
| 85 | === Get a course with id === |
| 86 | GET /v1/courses/{id} |
| 87 | ||parameter||COURSE_ID|| |
| 88 | ||input||none|| |
| 89 | ||status (success)||HTTP/1.1 200 OK|| |
| 90 | ||output (success)||{"id":"COURSE_ID","course":"COURSE_CODE","title":"COURSE_TITLE"}|| |
| 91 | ||status (failure)||HTTP/1.1 404 Not Found|| |
| 92 | ||status (failure)||No course with id COURSE_ID can be found|| |
| 93 | |
| 94 | === Create a course === |
| 95 | POST /v1/courses |
| 96 | ||parameter||none|| |
| 97 | ||input||{"Course":{"course":"COURSE_CODE","title":"COURSE_TITLE"},"Department":{"Department":[DEPARTMENT_ID]}}|| |
| 98 | ||status (success)||HTTP/1.1 201 Created|| |
| 99 | ||output (success)||COURSE_ID|| |
| 100 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 101 | ||output (failure)||Error: the course was not added|| |
| 102 | |
| 103 | === Remove a course with id === |
| 104 | DELETE /v1/courses/{id} |
| 105 | ||parameter||COURSE_ID|| |
| 106 | ||input||none|| |
| 107 | ||status (success)||HTTP/1.1 204 No Content|| |
| 108 | ||output (success)||COURSE_ID|| |
| 109 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 110 | ||output (failure)||Error: the course was not deleted|| |
| 111 | |
| 112 | === Update a course with id === |
| 113 | PUT /v1/courses/{id} |
| 114 | ||parameter||none|| |
| 115 | ||input||{"Course":{"id":"COURSE_ID","course":"COURSE_CODE","title":"COURSE_TITLE"}}|| |
| 116 | ||status (success)||HTTP/1.1 200 OK|| |
| 117 | ||output (success)||COURSE_ID|| |
| 118 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 119 | ||output (failure)||Error: the course was not edited|| |
| 120 | |
| 121 | == !Courses/Users == |
| 122 | |
| 123 | === Get a list of users associated within the course {course_id} === |
| 124 | GET /v1/courses/{course_id}/users |
| 125 | ||parameter||COURSE_ID|| |
| 126 | ||input|| none |
| 127 | ||status (success)||HTTP/1.1 201 Created|| |
| 128 | ||output (success)||[{"id": "1", "username":"username1", "role_id":1}, {"id": "2", "username":"username2", "role_id":1},{"id": "3", "username":"username3", "role_id":2}]|| |
| 129 | ||status (failure)||HTTP/1.1 400 Unrecognizable Request|| |
| 130 | ||output (failure)|| none || |
| 131 | |
| 132 | === Associate users to the course by {course_id} === |
| 133 | POST /v1/courses{course_id}/users |
| 134 | ||parameter||COURSE_ID|| |
| 135 | ||input||[{"username":"username1", "role_id":5}, {"username":"username2", "role_id":5},{"username":"username3", "role_id":4}], other fields in request will be ignored|| |
| 136 | ||status (success)||HTTP/1.1 200 OK|| |
| 137 | ||output (success)||[{"username":"username1", "role_id":5}, {"username":"username2", "role_id":5},{"username":"username3", "role_id":4}]|| |
| 138 | ||status (failure)||HTTP/1.1 501 Unsupported role for {username}|| |
| 139 | ||note (failure)|| The role_id was unrecognized, recognized role_ids right now are student (5), tutor (4), and instructor (3) || |
| 140 | ||status (failure)||HTTP/1.1 501 Fail to enrol {username}|| |
| 141 | ||note (failure)|| Tried to save the new enrolments but failed due to a database error. || |
| 142 | |
| 143 | === Remove a user from the course === |
| 144 | DELETE /v1/courses/{course_id}/users|| |
| 145 | ||parameter||COURSE_ID|| |
| 146 | ||input||[{"username":"username1", "role_id":5}, {"username":"username2", "role_id":5},{"username":"username3", "role_id":4}], other fields in request will be ignored|| |
| 147 | ||status (success)||HTTP/1.1 200 OK|| |
| 148 | ||output (success)||[{"username":"username1", "role_id":5}, {"username":"username2", "role_id":5},{"username":"username3", "role_id":4}]|| |
| 149 | ||status (failure)||HTTP/1.1 501 Unsupported role for {username}|| |
| 150 | ||note (failure)|| The role_id was unrecognized, recognized role_ids right now are student (5), tutor (4), and instructor (3) || |
| 151 | ||status (failure)||HTTP/1.1 501 Fail to drop {username}|| |
| 152 | ||note (failure)|| Tried to save the new enrolments but failed due to a database error. || |
| 153 | |
| 154 | == !Courses/Departments == |
| 155 | |
| 156 | === Add a course to a department === |
| 157 | POST /v1/courses/{course_id}/departments/{department_id} |
| 158 | ||parameter||DEPARTMENT_ID|| |
| 159 | ||parameter||COURSE_ID|| |
| 160 | ||status (success)||HTTP/1.1 201 Created|| |
| 161 | ||output (success)||{"course_id":"COURSE_ID", "department_id":"DEPARTMENT_ID"}|| |
| 162 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 163 | ||output (failure)||none|| |
| 164 | |
| 165 | === Delete a course from a department === |
| 166 | DELETE /v1/courses/{course_id}departments/{department_id} |
| 167 | ||parameter||DEPARTMENT_ID|| |
| 168 | ||parameter||COURSE_ID|| |
| 169 | ||status (success)||HTTP/1.1 204 No Content|| |
| 170 | ||output (success)||none|| |
| 171 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 172 | ||output (failure)||none|| |
| 173 | |
| 174 | == Departments == |
| 175 | |
| 176 | === Get a list of departments the user has access to === |
| 177 | GET v1/departments |
| 178 | ||parameter||none|| |
| 179 | ||status (success)||HTTP/1.1 200 OK|| |
| 180 | ||output (success)||[{"id":"DEPT_ID0","name":"DEPT_NAME0"},{"id":"DEPT_ID1","name":"DEPT_NAME1"}]|| |
| 181 | ||status (failure)||HTTP/1.1 404 Not Found|| |
| 182 | ||output (failure)||none|| |
| 183 | |
| 184 | === Get a list of courses that belongs to the department === |
| 185 | GET v1/departments/{department_id} |
| 186 | ||parameter||DEPARTMENT_ID|| |
| 187 | ||status (success)||HTTP/1.1 200 OK|| |
| 188 | ||output (success)||[{"id":"COURSE0_ID","course":"COURSE0_CODE","title":"COURSE0_TITLE"},{"id":"COURSE1_ID","course":"COURSE1_CODE","title":"COURSE1_TITLE"}]|| |
| 189 | ||status (failure)||HTTP/1.1 404 Not Found|| |
| 190 | ||output (failure)||none|| |
| 191 | |
| 192 | == Groups == |
| 193 | |
| 194 | === Get a list of groups in course {course_id} === |
| 195 | GET /v1/courses/{course_id}/groups |
| 196 | ||parameter||COURSE_ID|| |
| 197 | ||input||none|| |
| 198 | ||status (success)||HTTP/1.1 200 OK|| |
| 199 | ||output (success)||[{"id":"GROUP_IDO","group_num":"GROUP_NUM0","group_name":"GROUP_NAME0","course_id":"COURSE_ID"},{"id":"GROUP_ID1","group_num":"GROUP_NUM1","group_name":"GROUP_NAME1","course_id":"COURSE_ID"}], or [] if there is no group|| |
| 200 | ||status (failure)||HTTP/1.1 500 Internal Error|| |
| 201 | ||output (failure)||none|| |
| 202 | |
| 203 | === Get a group in course by group id, course_id will be ignored === |
| 204 | GET /v1/courses/{course_id}/groups/id |
| 205 | ||parameter||COURSE_ID|| |
| 206 | ||parameter||GROUP_ID|| |
| 207 | ||status (success)||HTTP/1.1 200 OK|| |
| 208 | ||output (success)||{"id":"GROUP_ID","group_num":"GROUP_NUM","group_name":"GROUP_NAME","course_id":"COURSE_ID"}|| |
| 209 | ||status (failure)||HTTP/1.1 404 Not Found|| |
| 210 | ||output (failure)||none|| |
| 211 | |
| 212 | === Create a group in course {course_id} === |
| 213 | POST /v1/courses/{course_id}/groups |
| 214 | ||parameter||COURSE_ID|| |
| 215 | ||input||{"group_num":"GROUP_NUM","group_name":"GROUP_NAME","course_id":"COURSE_ID"}|| |
| 216 | ||status (success)||HTTP/1.1 201 Created|| |
| 217 | ||output (success)||{"id":"GROUP_ID","group_num":"GROUP_NUM","group_name":"GROUP_NAME","course_id":"COURSE_ID"}|| |
| 218 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 219 | ||output (failure)||none|| |
| 220 | |
| 221 | === Remove a group in course by group id, course_id will be ignored === |
| 222 | DELETE /v1/courses/{course_id}/groups/{id} |
| 223 | ||parameter||COURSE_ID|| |
| 224 | ||parameter||GROUP_ID|| |
| 225 | ||status (success)||HTTP/1.1 204 No Content|| |
| 226 | ||output (success)||none|| |
| 227 | ||status (failure)||HTTP/1.1 500 Internal Server Error|| |
| 228 | ||output (failure)||none|| |
| 229 | |
| 230 | === Update a group in course by group id, course_id will be ignored === |
| 231 | PUT /v1/courses/{course_id}/groups/{id} |
| 232 | ||parameter||COURSE_ID|| |
| 233 | ||parameter||GROUP_ID|| |
| 234 | ||input||{"id":"GROUP_ID","course_id":"COURSE_ID","group_num":"GROUP_NUM","group_name":"GROUP_NAME"}|| |
| 235 | ||status (success)||HTTP/1.1 200 OK|| |
| 236 | ||output (success)||{"id":"GROUP_ID","group_num":"GROUP_NUM","group_name":"GROUP_NAME","course_id":"COURSE_ID"}|| |
| 237 | ||status (failure)||HTTP/1.1 200 OK|| |
| 238 | ||output (failure)||none|| |
| 239 | |
| 240 | == !Groups/Users == |
| 241 | |
| 242 | === Get a list of users associated within the group {group_id} === |
| 243 | GET /v1/groups/{group_id}/users |
| 244 | |
| 245 | === Associate users to the group by {group_id} === |
| 246 | POST /v1/groups{group_id}/users |
| 247 | |
| 248 | === Remove a user from the group === |
| 249 | DELETE /v1/groups/{group_id}/users/{user_id} |
| 250 | ||parameter||GROUP_ID|| |
| 251 | ||parameter||USER_ID|| |
| 252 | ||status (success)||HTTP/1.1 204 No Content|| |
| 253 | ||output (success)||none|| |
| 254 | ||status (failure)||HTTP/1.1 500 users were not deleted|| |
| 255 | ||output (failure)|| none || |
| 256 | |
| 257 | == Grades == |
| 258 | |
| 259 | === Get a list of grades in event {event_id} === |
| 260 | GET /v1/events/{event_id}/grades |
| 261 | ||parameter||EVENT_ID|| |
| 262 | ||status (success)||HTTP/1.1 200 OK|| |
| 263 | ||output (success)||[{"evaluatee":"EVALUATEE_ID","score":"SCORE"},{"evaluatee":"EVALUATEE_ID","score":"SCORE"}]|| |
| 264 | ||status (failure)||HTTP/1.1 404 Not Found|| |
| 265 | ||output (failure)||none|| |
| 266 | |
| 267 | === Get a grades for a user with {user_id} in the event {event_id} === |
| 268 | GET /v1/events/{event_id}/grades/{user_id} |
| 269 | ||parameter||EVENT_ID|| |
| 270 | ||parameter||USER_ID|| |
| 271 | ||status (success)||HTTP/1.1 200 OK|| |
| 272 | ||output (success)||{"evaluatee":"USER_ID","score":"SCORE"} |
| 273 | ||status (failure)||HTTP/1.1 404 Not Found|| |
| 274 | ||output (failure)||none|| |