Ocicat API
Resource Group ¶
Users ¶
用户资源表示
使用选择的id来查询用户GET/users/{user}
Example URI
GET /users/user
URI Parameters
- user
integer
(required)用户id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"uuid": "8758c471-f7e3-11e6-ab55-080027b55b5e",
"username": "tristian.aufderhar",
"email": "leanna19@kilback.com",
"role_id": null,
"role_type": null,
"status": "active",
"profile": {
"nickname": null,
"realname": null,
"age": null,
"gender": "secret",
"phone": null
}
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
搜索用户GET/users
可在url中使用username, email, uuid,status, role_type, role_id,nickname, realname, age, gender, phone 可多个条件组合使用,此时返回的data中是数组
Example URI
GET /users
URI Parameters
- username
string
(optional)用户名
string
(optional)Email
- uuid
string
(optional)uuid
- status
string
(optional)用户状态
- role_type
string
(optional)用户角色类型
- role_id
integer
(optional)用户角色id
- nickname
string
(optional)用户昵称
- realname
string
(optional)用户真名
- age
string
(optional)用户年龄
- gender
string
(optional)用户性别
- phone
string
(optional)用户电话号码
Request
Headers
Content-Type: application/x-www-form-urlencoded
Body
username={username}&email={email}&uuid={uuid}&status={status}&role_type={role_type}&role_id={role_id}&nickname={nickname}&realname={realname}&age={age}&gender={gender}&phone={phone}
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"uuid": "8758c471-f7e3-11e6-ab55-080027b55b5e",
"username": "tristian.aufderhar",
"email": "leanna19@kilback.com",
"role_id": null,
"role_type": null,
"status": "active",
"profile": {
"nickname": null,
"realname": null,
"age": null,
"gender": "secret",
"phone": null
}
}
}
Response
204
Headers
Content-Type: application/json
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Users ¶
用户资源表示
添加一个用户POST/users
字段验证将在User模型内完成
Example URI
POST /users
URI Parameters
- username
string
(required)用户名,^[a-z][a-z0-9_.]{3,23}
string
(required)用户邮箱,邮箱格式
- password
string
(required)用户密码
Request
Headers
Content-Type: application/json
Body
{
"data": {
"username": "example",
"email": "example@mail.com",
"password": "my_password"
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
409
Headers
Content-Type: application/json
Body
{
"message": "Conflicted.",
"status_code": "409",
"errors": {
"username": "..."
}
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not create new user.",
"status_code": 422,
"errors": {
"username": "The username field is required."
}
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
删除指定id的用户DELETE/users/{user}
Example URI
DELETE /users/user
URI Parameters
- user
integer
(required)用户id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not delete a user.",
"status_code": 422,
"errors": {
"...": "..."
}
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定用户PUT/users/{user}
Example URI
PUT /users/user
URI Parameters
- user
integer
(optional)用户id
- username
string
(required)用户名,^[a-z][a-z0-9_.]{3,23}
string
(optional)用户邮箱,邮箱格式
- password
string
(optional)用户密码
- status
string
(optional)用户状态,枚举[active,suspend]
Request
Headers
Content-Type: application/json
Body
{
"data": {
"username": "example",
"email": "example@mail.com",
"password": "my_password",
"status": "active"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
409
Headers
Content-Type: application/json
Body
{
"message": "Conflicted.",
"status_code": "409",
"errors": {
"username": "..."
}
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not update user.",
"status_code": 422,
"errors": {
"...": "..."
}
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定用户信息PUT/users/{user}/profile
Example URI
PUT /users/user/profile
URI Parameters
- user
integer
(optional)用户id
Request
Headers
Content-Type: application/json
Body
{
"data": {
"nickname": "example",
"realname": "my name",
"age": 18,
"gender": "male",
"phone": "12345678"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Users 角色 ¶
用户-角色资源表示
获取一个用户角色的uriGET/users/{user}/role
Example URI
GET /users/user/role
URI Parameters
- user
integer
(required)用户id
Response
200
Headers
Content-Type: application/json
Body
{
"id": 3439,
"type": "admin",
"uri": "http://api.ocicat.dev/admins/3439"
}
Response
400
Headers
Content-Type: application/json
Body
{
"message": "User's role not exists.",
"status_code": "400"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
为用户附加一个角色PUT/users/{user}/role
Example URI
PUT /users/user/role
URI Parameters
- user
integer
(required)用户id
- role_id
integer
(required)角色id
- role_type
string
(required)角色类型
Request
Headers
Content-Type: application/json
Body
{
"data": {
"role_id": 123,
"role_type": "admin"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "Missing field.",
"status_code": "400"
}
Response
400
Headers
Content-Type: application/json
Body
{
"message": "Wrong role type.",
"status_code": "400"
}
Response
400
Headers
Content-Type: application/json
Body
{
"message": "Role not found.",
"status_code": "400"
}
Response
400
Headers
Content-Type: application/json
Body
{
"message": "This role has already been attached.",
"status_code": "400"
}
Response
409
Headers
Content-Type: application/json
Body
{
"message": "User already attached an role.",
"status_code": "409"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
为用户解除角色附加DELETE/users/{user}/role
Example URI
DELETE /users/user/role
URI Parameters
- user
integer
(required)用户id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Me ¶
当前用户资源表示
获取tokenPOST/me
用用户名或邮箱,加上密码获取token
Example URI
POST /me
URI Parameters
- username
string
(optional)用户名,^[a-z][a-z0-9_.]{3,23}
string
(optional)用户邮箱,邮箱格式
- password
string
(required)用户密码
Request
Headers
Content-Type: application/json
Body
{
"data": {
"username": "example",
"email": "example@mail.com",
"password": "my_password"
}
}
Response
200
Headers
Content-Type: application/json
Body
{
"token": "..."
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "404"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新tokenGET/me/refresh_token
token将在头部返回
Example URI
GET /me/refresh_token
Request
Headers
Content-Type: application/json
Authorization: Bearer [user's token here]
Response
200
Headers
Content-Type: application/json
Authorization: Bearer [your token here]
Response
404
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "404"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
获取当前用户的信息GET/me
Example URI
GET /me
Request
Headers
Content-Type: application/json
Authorization: Bearer [user's token here]
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"uuid": "8758c471-f7e3-11e6-ab55-080027b55b5e",
"username": "tristian.aufderhar",
"email": "leanna19@kilback.com",
"role_id": null,
"role_type": null,
"status": "active",
"profile": {
"nickname": null,
"realname": null,
"age": null,
"gender": "secret",
"phone": null
}
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新当前用户邮箱PUT/me/email
Example URI
PUT /me/email
URI Parameters
string
(required)用户邮箱,邮箱格式
Request
Headers
Content-Type: application/json
Authorization: Bearer [user's token here]
Body
{
"data": {
"email": "new_mail@mail.com"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新当前用户的密码PUT/me/password
Example URI
PUT /me/password
URI Parameters
- old_password
string
(required)用户密码,原密码
- password
string
(required)用户新密码
Request
Headers
Content-Type: application/json
Authorization: Bearer [user's token here]
Body
{
"data": {
"old_password": "password",
"password": "my_password"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定用户信息PUT/me/profile
Example URI
PUT /me/profile
Request
Headers
Content-Type: application/json
Body
{
"data": {
"nickname": "example",
"realname": "my name",
"age": 18,
"gender": "male",
"phone": "12345678"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/users/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
获取用户角色GET/me/role
Example URI
GET /me/role
Response
200
Headers
Content-Type: application/json
Body
{
"id": "12",
"user_id": "34",
"...": "..."
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "User's role not exists.",
"status_code": "404"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
为当前用户添加角色POST/me/role
仅在新用户绑定角色时适用
Example URI
POST /me/role
Request
Headers
Content-Type: application/json
Body
{
"data": {
"role_type": "teacher",
"...": "..."
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/teacher/2589
Response
409
Headers
Content-Type: application/json
Body
{
"message": "User's role exists.",
"status_code": "409"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
为当前用户更新角色PUT/me/role
Example URI
PUT /me/role
Request
Headers
Content-Type: application/json
Body
{
"data": {
"...": "..."
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/.../2589
Response
409
Headers
Content-Type: application/json
Body
{
"message": "User's role exists.",
"status_code": "409"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
学生提交pin签到验证码POST/me/pin
Example URI
POST /me/pin
Request
Headers
Content-Type: application/json
Body
{
"data": {
"pin": 123123
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/attendances/2589
Response
403
Headers
Content-Type: application/json
Body
{
"message": "User's role exists.",
"status_code": "409"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
401
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "401"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Admin ¶
管理员角色资源表示
使用选择的id来查询管理员GET/admins/{admin}
Example URI
GET /admins/admin
URI Parameters
- admin
integer
(required)管理员id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"role": "admin",
"group": "my_group"
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
添加管理员POST/admins
Example URI
POST /admins
URI Parameters
- group
string
(optional)管理员组
Request
Headers
Content-Type: application/json
Body
{
"data": {
"group": "my_group"
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/admins/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not add admin.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定管理员PUT/admins/{admin}
Example URI
PUT /admins/admin
URI Parameters
- admin
integer
(optional)管理员id
- group
string
(optional)管理员组
Request
Headers
Content-Type: application/json
Body
{
"data": {
"group": "my_group"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/admins/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not update admin.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
删除指定id的管理员DELETE/admins/{admin}
Example URI
DELETE /admins/admin
URI Parameters
- admin
integer
(required)管理员id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/admins/2589
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not delete an admin.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Student ¶
学生角色资源表示
使用选择的id来查询学生GET/students/{student}
Example URI
GET /students/student
URI Parameters
- student
integer
(required)学生id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"role": "student",
"student_number": "4354325223",
"classn_id": "1324",
"profile": "..."
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
添加学生POST/students
Example URI
POST /students
URI Parameters
- student_number
string
(optional)学号
Request
Headers
Content-Type: application/json
Body
{
"data": {
"student_number": "4354325223"
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/students/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not add student.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定学生PUT/students/{student}
Example URI
PUT /students/student
URI Parameters
- student
integer
(optional)学生id
- student_number
string
(optional)学号
Request
Headers
Content-Type: application/json
Body
{
"data": {
"student_number": "4354325223"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/students/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not update student.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
删除指定id的学生DELETE/students/{student}
Example URI
DELETE /students/student
URI Parameters
- student
integer
(required)学生id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/students/2589
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not delete an student.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
将指定学生添加到班级POST/students/{student}/classn
Example URI
POST /students/student/classn
URI Parameters
- student
integer
(required)学生id
- classn_id
integer
(required)班级id
Request
Headers
Content-Type: application/json
Body
{
"data": {
"classn_id": "4354325223"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/classns/4354325223
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
409
Headers
Content-Type: application/json
Body
{
"message": "Student already attached a class.",
"status_code": "409"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
为学生解除班级附加DELETE/students/{student}/classn
Example URI
DELETE /students/student/classn
URI Parameters
- student
integer
(required)学生id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/students/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
使用选择的id来学生所有出席记录GET/students/{student}/lessons
Example URI
GET /students/student/lessons
URI Parameters
- student
integer
(required)学生id
Response
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1231,
"lesson_id": 12312,
"student": 1121,
"timestamp": 1231223324
},
{
"id": 1232,
"lesson_id": 12312,
"student": 1121,
"timestamp": 1231223324
}
]
}
Response
204
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "204"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Teacher ¶
老师角色资源表示
使用选择的id来查询老师GET/teachers/{teacher}
Example URI
GET /teachers/teacher
URI Parameters
- teacher
integer
(required)老师id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"role": "teacher",
"employee_number": "4354325223",
"profile": "..."
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
添加老师POST/teachers
Example URI
POST /teachers
URI Parameters
- employee_number
string
(optional)工号
Request
Headers
Content-Type: application/json
Body
{
"data": {
"employee_number": "4354325223"
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/teachers/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not add teacher.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定老师PUT/teachers/{teacher}
Example URI
PUT /teachers/teacher
URI Parameters
- teacher
integer
(optional)老师id
- employee_number
string
(optional)工号
Request
Headers
Content-Type: application/json
Body
{
"data": {
"employee_number": "4354325223"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/teachers/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not update teacher.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
删除指定id的老师DELETE/teachers/{teacher}
Example URI
DELETE /teachers/teacher
URI Parameters
- teacher
integer
(required)老师id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/teachers/2589
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not delete an teacher.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
使用选择的id来查询老师所有课程GET/teachers/courses
Example URI
GET /teachers/courses
URI Parameters
- classn
integer
(required)老师id
Response
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1231,
"name": "课程1",
"teacher_id": 12312
},
{
"id": 1232,
"name": "课程2",
"teacher_id": 12312
}
]
}
Response
204
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "204"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Attendance ¶
出勤记录资源表示
使用选择的id来查询出勤记录GET/attendances/{attendance}
Example URI
GET /attendances/attendance
URI Parameters
- attendance
integer
(required)出勤记录id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"student_id": 1123,
"lesson_id": 122,
"timestamp": 1231223324
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
添加出勤记录POST/attendances
Example URI
POST /attendances
Request
Headers
Content-Type: application/json
Body
{
"data": {
"student_id": 1231,
"lesson_id": 11
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/attendances/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not add attendance.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
删除指定id的出勤记录DELETE/attendances/{attendance}
Example URI
DELETE /attendances/attendance
URI Parameters
- attendance
integer
(required)出勤记录id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/attendances/2589
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not delete attendance.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定出勤记录PUT/attendances/{attendance}
Example URI
PUT /attendances/attendance
URI Parameters
- attendance
integer
(optional)出勤记录id
Request
Headers
Content-Type: application/json
Body
{
"data": {
"...": "..."
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/attendances/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not update attendance.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
获取出勤记录的平铺信息GET/attendances/{attendance}
响应中将展开课时和学生
Example URI
GET /attendances/attendance
URI Parameters
- attendance
integer
(required)出勤记录id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"student": {
"...": "..."
},
"lesson": {
"...": "..."
},
"timestamp": 1231223324
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found.",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Classn ¶
班级资源表示
使用选择的id来查询班级GET/classns/{classn}
Example URI
GET /classns/classn
URI Parameters
- classn
integer
(required)班级id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"name": "classn name"
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
添加班级POST/classns
Example URI
POST /classns
Request
Headers
Content-Type: application/json
Body
{
"data": {
"name": "classn name"
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/classns/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not add classn.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
删除指定id的班级DELETE/classns/{classn}
Example URI
DELETE /classns/classn
URI Parameters
- classn
integer
(required)班级id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/classns/2589
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not delete classn.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定班级PUT/classns/{classn}
Example URI
PUT /classns/classn
URI Parameters
- classn
integer
(optional)班级id
Request
Headers
Content-Type: application/json
Body
{
"data": {
"name": "classn name"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/classns/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not update classn.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
使用选择的id来查询班级所有课程GET/classns/{classn}/courses
Example URI
GET /classns/classn/courses
URI Parameters
- classn
integer
(required)班级id
Response
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1231,
"name": "课程1",
"teacher_id": 12312
},
{
"id": 1232,
"name": "课程2",
"teacher_id": 12312
}
]
}
Response
204
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "204"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
使用选择的id来查询班级所有学生GET/classns/{classn}/students
Example URI
GET /classns/classn/students
URI Parameters
- classn
integer
(required)班级id
Response
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1231,
"role": "student",
"classn_id": 1112,
"profile": "..."
},
{
"id": 1232,
"role": "student",
"classn_id": 1112,
"profile": "..."
}
]
}
Response
204
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "204"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Course ¶
课程资源表示
使用选择的id来查询课程GET/courses/{course}
Example URI
GET /courses/course
URI Parameters
- course
integer
(required)课程id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"teacher_id": 12312,
"name": "课程1"
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
使用选择的id来查询课程详细信息GET/courses/{course}.flat
Example URI
GET /courses/course.flat
URI Parameters
- course
integer
(required)课程id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"teacher": {
"...": "..."
},
"name": "课程1",
"lessons": {
"...": "..."
}
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
添加课程POST/courses
Example URI
POST /courses
Request
Headers
Content-Type: application/json
Body
{
"data": {
"...": "..."
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/courses/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not add course.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
删除指定id的课程DELETE/courses/{course}
Example URI
DELETE /courses/course
URI Parameters
- course
integer
(required)课程id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/courses/2589
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not delete course.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定课程PUT/courses/{course}
Example URI
PUT /courses/course
URI Parameters
- course
integer
(optional)课程id
Request
Headers
Content-Type: application/json
Body
{
"data": {
"name": "课程1"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/courses/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not update course.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
将指定课程添加到老师POST/courses/{course}/teacher
Example URI
POST /courses/course/teacher
URI Parameters
- course
integer
(required)课程id
- teacher_id
integer
(required)老师id
Request
Headers
Content-Type: application/json
Body
{
"data": {
"teacher_id": "4354325223"
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/teachers/4354325223
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
409
Headers
Content-Type: application/json
Body
{
"message": "Course already attached a teacher.",
"status_code": "409"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
为课程解除老师附加DELETE/courses/{course}/teacher
Example URI
DELETE /courses/course/teacher
URI Parameters
- course
integer
(required)课程id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/courses/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
为课程添加课时POST/courses/{course}/lessons
Example URI
POST /courses/course/lessons
URI Parameters
- course
integer
(required)课程id
Request
Headers
Content-Type: application/json
Body
{
"data": []
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/lessons/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not add lesson.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
使用选择的id来查询课程所有班级GET/courses/{course}/classns
Example URI
GET /courses/course/classns
URI Parameters
- course
integer
(required)课程id
Response
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1231,
"name": "班级1"
},
{
"id": 1232,
"name": "班级2"
}
]
}
Response
204
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "204"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
使用选择的id来查询课程所有课时GET/courses/{course}/lessons
Example URI
GET /courses/course/lessons
URI Parameters
- course
integer
(required)课程id
Response
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1231,
"course_id": 12312,
"timestamp": 1231223324
},
{
"id": 1232,
"course_id": 12312,
"timestamp": 1231223324
}
]
}
Response
204
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "204"
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
为课程连接班级PUT/courses/{course}/classns
Example URI
PUT /courses/course/classns
URI Parameters
- course
integer
(required)课程id
- classn_id
integer
(required)班级id
Request
Headers
Content-Type: application/json
Body
{
"data": {
"classn_id": 11123
}
}
Response
201
Headers
Content-Type: application/json
location: http://api.ocicat.dev/classns/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not add lesson.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
Lesson ¶
课时资源表示
使用选择的id来查询课时GET/lessons/{lesson}
Example URI
GET /lessons/lesson
URI Parameters
- lesson
integer
(required)课时id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"id": 6179,
"course_id": 12312,
"timestamp": 1231223324
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
删除指定id的课时DELETE/lessons/{lesson}
Example URI
DELETE /lessons/lesson
URI Parameters
- lesson
integer
(required)课时id
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/lessons/2589
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not delete lesson.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
更新指定课时PUT/lessons/{lesson}
Example URI
PUT /lessons/lesson
URI Parameters
- lesson
integer
(optional)课时id
Request
Headers
Content-Type: application/json
Body
{
"data": {
"...": "..."
}
}
Response
202
Headers
Content-Type: application/json
location: http://api.ocicat.dev/lessons/2589
Response
400
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "400"
}
Response
422
Headers
Content-Type: application/json
Body
{
"message": "Could not update lesson.",
"status_code": 422
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
使用选择的id来查询课时所有出席记录GET/lessons/{lesson}/lessons
Example URI
GET /lessons/lesson/lessons
URI Parameters
- lesson
integer
(required)课时id
Response
200
Headers
Content-Type: application/json
Body
{
"data": [
{
"id": 1231,
"lesson_id": 12312,
"student": 1121,
"timestamp": 1231223324
},
{
"id": 1232,
"lesson_id": 12312,
"student": 1121,
"timestamp": 1231223324
}
]
}
Response
204
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "204"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}
使用选择的id来查询课时的签到验证码pinGET/lessons/{lesson}/pin
Example URI
GET /lessons/lesson/pin
URI Parameters
- lesson
integer
(required)课时id
Response
200
Headers
Content-Type: application/json
Body
{
"data": {
"pin": 11111
}
}
Response
404
Headers
Content-Type: application/json
Body
{
"message": "404 Not Found",
"status_code": "404"
}
Response
500
Headers
Content-Type: application/json
Body
{
"message": "",
"status_code": "500"
}