A | B | C | D | E | F | G | H | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | AD | AE | AF | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | NOTE! This document is archived and is not updated anymore. It only specified the initial design of the API. | |||||||||||||||||||||||||||||||
2 | Server repository: | https://github.com/Spacha/PoliisiautoServer | ||||||||||||||||||||||||||||||
3 | API description: | https://documenter.getpostman.com/view/3550280/2s8YzUwMLQ#5ce6ad23-430b-4aff-9b25-26f633d7d8c4 | ||||||||||||||||||||||||||||||
4 | Endpoint | Request | Response | Student | Teacher | Administrator | Permissions | Permission exceptions | Verb | Route | Controller | Method | Notes | |||||||||||||||||||
5 | # Organization | |||||||||||||||||||||||||||||||
6 | list all organizations | List | No one | GET | organizations | OrganizationController | index | |||||||||||||||||||||||||
7 | store a new organization | OK / error | No one | POST | organizations | OrganizationController | store | |||||||||||||||||||||||||
8 | show an organization | organization ID | Object | By anyone | GET | organizations | OrganizationController | show | ||||||||||||||||||||||||
9 | update an organization | organization ID | OK / error | Administrators | PATCH | organizations/{id} | OrganizationController | update | ||||||||||||||||||||||||
10 | delete an organization | organization ID | OK / error | No one | DELETE | organizations/{id} | OrganizationController | destroy | ||||||||||||||||||||||||
11 | # Case | |||||||||||||||||||||||||||||||
12 | list all cases in the organization | teacher->organization | List | Teachers | GET | cases | CaseController | index | ||||||||||||||||||||||||
13 | store a new case | teacher->organization | OK / error | Students | POST | cases | CaseController | store | ||||||||||||||||||||||||
14 | show a case | case ID | Object | Teachers | GET | cases/{id} | CaseController | show | ||||||||||||||||||||||||
15 | update a case | case ID | OK / error | Teachers | PATCH | cases/{id} | CaseController | update | ||||||||||||||||||||||||
16 | delete a case | case ID | OK / error | Teachers | DELETE | cases/{id} | CaseController | destroy | ||||||||||||||||||||||||
17 | list all reports in the case | case ID | List | Teachers | GET | cases/{id}/reports | CaseController | reports | ||||||||||||||||||||||||
18 | # Report | |||||||||||||||||||||||||||||||
19 | list all reports in the organization | user->organization | List | Teachers | GET | reports | ReportController | index | ||||||||||||||||||||||||
20 | store a new report | case ID | OK / error | Teachers | Student (reporter) | POST | cases/{case_id}/reports | ReportController | store | When a student stores a new report, it is not assigned to any particular case. A teacher may later add it to a case. | ||||||||||||||||||||||
21 | show a report | report ID | Object | Teachers | Student (reporter) | GET | reports/{id} | ReportController | show | |||||||||||||||||||||||
22 | update a report | report ID | OK / error | Teachers | Student (reporter) | PATCH | reports/{id} | ReportController | update | |||||||||||||||||||||||
23 | delete a report | report ID | OK / error | Teachers | Student (reporter) | DELETE | reports/{id} | ReportController | destroy | |||||||||||||||||||||||
24 | list all report messages in the report | report ID | List | Teachers | GET | reports/{id}/messages | ReportController | messages | ||||||||||||||||||||||||
25 | update the case of the report | report ID | OK / error | Teachers | PUT | reports/{id}/update-case | ReportController | updateCase | ||||||||||||||||||||||||
26 | store a new report to a new case | OK / error | Teachers | Student (reporter) | POST | reports | ReportController | storeToNewCase | ||||||||||||||||||||||||
27 | # Report message | |||||||||||||||||||||||||||||||
28 | store a new report message to the report | report ID | OK / error | Teachers | Student (reporter) | POST | reports/{report_id}/messages | ReportMessageController | store | |||||||||||||||||||||||
29 | show a report message | report message ID | Object | Teachers | Student (reporter) | GET | report-messages/{id} | ReportMessageController | show | |||||||||||||||||||||||
30 | update a report message | report message ID | OK / error | Teachers | Student (reporter) | PATCH | report-messages/{id} | ReportMessageController | update | |||||||||||||||||||||||
31 | delete a report message | report message ID | OK / error | Teachers | Student (reporter) | DELETE | report-messages/{id} | ReportMessageController | destroy | |||||||||||||||||||||||
32 | # Student | |||||||||||||||||||||||||||||||
33 | list all students in the organization | teacher->organization | List | Teachers | GET | students | StudentController | index | ||||||||||||||||||||||||
34 | store a new student to the organization | teacher->organization | OK / error | Teachers | POST | students | StudentController | store | ||||||||||||||||||||||||
35 | show a student | student ID | Object | Teachers | Student (self) | GET | students/{id} | StudentController | show | |||||||||||||||||||||||
36 | update a student | student ID | OK / error | Students | Student (self) | PATCH | students/{id} | StudentController | update | |||||||||||||||||||||||
37 | delete a student | student ID | OK / error | Administrators | DELETE | students/{id} | StudentController | destroy | ||||||||||||||||||||||||
38 | list all reports the student is involved in | student ID | List | Reports are grouped by involvement type: bully, bullied, bystander | Teachers | GET | students/{id}/involved-reports | StudentController | involvedReports | |||||||||||||||||||||||
39 | list all reports the student has created | student ID | List | Teachers | Student (self) | GET | students/{id}/reports | StudentController | reports | |||||||||||||||||||||||
40 | # Teacher | |||||||||||||||||||||||||||||||
41 | list all teachers in the organization | user->organization | List | By anyone | GET | teachers | TeacherController | index | ||||||||||||||||||||||||
42 | store a new teacher | administrator->organization | OK / error | Administrators | POST | teachers | TeacherController | store | ||||||||||||||||||||||||
43 | show a teacher | teacher ID | Object | By anyone | GET | teachers/{id} | TeacherController | show | ||||||||||||||||||||||||
44 | update a teacher | teacher ID | OK / error | Administrators | Teacher (self) | PATCH | teachers/{id} | TeacherController | update | |||||||||||||||||||||||
45 | delete a teacher | teacher ID | OK / error | Administrators | DELETE | teachers/{id} | TeacherController | destroy | ||||||||||||||||||||||||
46 | list all reports assigned to the teacher | teacher ID | List | Teachers | GET | teachers/{id}/assigned-reports | TeacherController | assignedReports | ||||||||||||||||||||||||
47 | list all reports the teacher has created | teacher ID | List | Teachers | GET | teachers/{id}/reports | TeacherController | reports | ||||||||||||||||||||||||
48 | # Administrator | |||||||||||||||||||||||||||||||
49 | list all administrators in the organization | administrator->organization | List | Administrators | GET | administrators | AdministratorController | index | ||||||||||||||||||||||||
50 | store a new administrator | administrator->organization | OK / error | Administrators | POST | administrators | AdministratorController | store | ||||||||||||||||||||||||
51 | show an administrator | administrator ID | Object | Administrators | GET | administrators/{id} | AdministratorController | show | ||||||||||||||||||||||||
52 | update an administrator | administrator ID | OK / error | Administrators | PATCH | administrators/{id} | AdministratorController | update | ||||||||||||||||||||||||
53 | delete an administrator | administrator ID | OK / error | Administrators | DELETE | administrators/{id} | AdministratorController | destroy | ||||||||||||||||||||||||
54 | ||||||||||||||||||||||||||||||||
55 | In addition, there is AuthController which has login functionality and other methods related to authorization and authorized user. | |||||||||||||||||||||||||||||||
56 | ||||||||||||||||||||||||||||||||
57 | NOTES | |||||||||||||||||||||||||||||||
58 | Route rules: | |||||||||||||||||||||||||||||||
59 | Use ID if it is referring to the resource the controller refers to. Otherwise use resource_id | |||||||||||||||||||||||||||||||
60 | Shallow routing; no redundant IDs in the URL | |||||||||||||||||||||||||||||||
61 | Using user's organization as the base, it's not passed as a parameter | |||||||||||||||||||||||||||||||
62 | All resource routes are in plural | |||||||||||||||||||||||||||||||
63 | ||||||||||||||||||||||||||||||||
64 | ||||||||||||||||||||||||||||||||
65 | Permissions: | |||||||||||||||||||||||||||||||
66 | User must have an organization in order to access any other than auth routes! | |||||||||||||||||||||||||||||||
67 | ||||||||||||||||||||||||||||||||
68 | Cases: | |||||||||||||||||||||||||||||||
69 | Student's don't know anything about cases. They are only for teachers. | |||||||||||||||||||||||||||||||
70 | When a user stores a new report, a new empty case is created. A teacher may move the report to another case if they notice that it may be related, or they can name the newly created case. | |||||||||||||||||||||||||||||||
71 | In the front-end, cases are always distinguished by case ID (Case #123), but if they have a name, that is also shown. | |||||||||||||||||||||||||||||||
72 | ||||||||||||||||||||||||||||||||
73 | ||||||||||||||||||||||||||||||||
74 | ||||||||||||||||||||||||||||||||
75 | ||||||||||||||||||||||||||||||||
76 | ||||||||||||||||||||||||||||||||
77 | ||||||||||||||||||||||||||||||||
78 | ||||||||||||||||||||||||||||||||
79 | ||||||||||||||||||||||||||||||||
80 | ||||||||||||||||||||||||||||||||
81 | ||||||||||||||||||||||||||||||||
82 | ||||||||||||||||||||||||||||||||
83 | ||||||||||||||||||||||||||||||||
84 | ||||||||||||||||||||||||||||||||
85 | ||||||||||||||||||||||||||||||||
86 | ||||||||||||||||||||||||||||||||
87 | ||||||||||||||||||||||||||||||||
88 | ||||||||||||||||||||||||||||||||
89 | ||||||||||||||||||||||||||||||||
90 | ||||||||||||||||||||||||||||||||
91 | ||||||||||||||||||||||||||||||||
92 | ||||||||||||||||||||||||||||||||
93 | ||||||||||||||||||||||||||||||||
94 | ||||||||||||||||||||||||||||||||
95 | ||||||||||||||||||||||||||||||||
96 | ||||||||||||||||||||||||||||||||
97 | ||||||||||||||||||||||||||||||||
98 | ||||||||||||||||||||||||||||||||
99 | ||||||||||||||||||||||||||||||||
100 |