ABCDEFGHJKLMNOPQRSTUVWXYZAAABACADAEAF
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
EndpointRequestResponse
Student
Teacher
Administrator
PermissionsPermission exceptionsVerbRouteControllerMethodNotes
5
# Organization
6
list all organizationsListNo oneGETorganizationsOrganizationControllerindex
7
store a new organizationOK / errorNo onePOSTorganizationsOrganizationControllerstore
8
show an organizationorganization IDObjectBy anyoneGETorganizationsOrganizationControllershow
9
update an organizationorganization IDOK / errorAdministratorsPATCHorganizations/{id}OrganizationControllerupdate
10
delete an organizationorganization IDOK / errorNo oneDELETEorganizations/{id}OrganizationControllerdestroy
11
# Case
12
list all cases in the organizationteacher->organizationListTeachersGETcasesCaseControllerindex
13
store a new caseteacher->organizationOK / errorStudentsPOSTcasesCaseControllerstore
14
show a casecase IDObjectTeachersGETcases/{id}CaseControllershow
15
update a casecase IDOK / errorTeachersPATCHcases/{id}CaseControllerupdate
16
delete a casecase IDOK / errorTeachersDELETEcases/{id}CaseControllerdestroy
17
list all reports in the casecase IDListTeachersGETcases/{id}/reportsCaseControllerreports
18
# Report
19
list all reports in the organizationuser->organizationListTeachersGETreportsReportControllerindex
20
store a new reportcase IDOK / errorTeachersStudent (reporter)POSTcases/{case_id}/reportsReportControllerstore
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 reportreport IDObjectTeachersStudent (reporter)GETreports/{id}ReportControllershow
22
update a reportreport IDOK / errorTeachersStudent (reporter)PATCHreports/{id}ReportControllerupdate
23
delete a reportreport IDOK / errorTeachersStudent (reporter)DELETEreports/{id}ReportControllerdestroy
24
list all report messages in the reportreport IDListTeachersGETreports/{id}/messagesReportControllermessages
25
update the case of the reportreport IDOK / errorTeachersPUTreports/{id}/update-caseReportControllerupdateCase
26
store a new report to a new caseOK / errorTeachersStudent (reporter)POSTreportsReportControllerstoreToNewCase
27
# Report message
28
store a new report message to the reportreport IDOK / errorTeachersStudent (reporter)POSTreports/{report_id}/messagesReportMessageControllerstore
29
show a report messagereport message IDObjectTeachersStudent (reporter)GETreport-messages/{id}ReportMessageControllershow
30
update a report messagereport message IDOK / errorTeachersStudent (reporter)PATCHreport-messages/{id}ReportMessageControllerupdate
31
delete a report messagereport message IDOK / errorTeachersStudent (reporter)DELETEreport-messages/{id}ReportMessageControllerdestroy
32
# Student
33
list all students in the organizationteacher->organizationListTeachersGETstudentsStudentControllerindex
34
store a new student to the organizationteacher->organizationOK / errorTeachersPOSTstudentsStudentControllerstore
35
show a studentstudent IDObjectTeachersStudent (self)GETstudents/{id}StudentControllershow
36
update a studentstudent IDOK / errorStudentsStudent (self)PATCHstudents/{id}StudentControllerupdate
37
delete a studentstudent IDOK / errorAdministratorsDELETEstudents/{id}StudentControllerdestroy
38
list all reports the student is involved instudent IDList
Reports are grouped by involvement type: bully, bullied, bystander
TeachersGETstudents/{id}/involved-reportsStudentControllerinvolvedReports
39
list all reports the student has createdstudent IDListTeachersStudent (self)GETstudents/{id}/reportsStudentControllerreports
40
# Teacher
41
list all teachers in the organizationuser->organizationListBy anyoneGETteachersTeacherControllerindex
42
store a new teacheradministrator->organizationOK / errorAdministratorsPOSTteachersTeacherControllerstore
43
show a teacherteacher IDObjectBy anyoneGETteachers/{id}TeacherControllershow
44
update a teacherteacher IDOK / errorAdministratorsTeacher (self)PATCHteachers/{id}TeacherControllerupdate
45
delete a teacherteacher IDOK / errorAdministratorsDELETEteachers/{id}TeacherControllerdestroy
46
list all reports assigned to the teacherteacher IDListTeachersGETteachers/{id}/assigned-reportsTeacherControllerassignedReports
47
list all reports the teacher has createdteacher IDListTeachersGETteachers/{id}/reportsTeacherControllerreports
48
# Administrator
49
list all administrators in the organizationadministrator->organizationListAdministratorsGETadministratorsAdministratorControllerindex
50
store a new administratoradministrator->organizationOK / errorAdministratorsPOSTadministratorsAdministratorControllerstore
51
show an administratoradministrator IDObjectAdministratorsGETadministrators/{id}AdministratorControllershow
52
update an administratoradministrator IDOK / errorAdministratorsPATCHadministrators/{id}AdministratorControllerupdate
53
delete an administratoradministrator IDOK / errorAdministratorsDELETEadministrators/{id}AdministratorControllerdestroy
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