Skip to content

Interfaces for teacher client

Insane edited this page Sep 9, 2015 · 1 revision

1. POST /employee_login.do

request payload:

{"account_name": "teacher_login_name", "password": "111111"}

json response:

{
"id":"3_93740362_3344",
"name":"王老师",
"phone":"13799999040",
"gender":0,
"workgroup":"教师组",
"workduty":"教师",
"portrait":"",
"birthday":"1987-06-04",
"school_id":93740362,
"login_name":"e0002",
"timestamp":1399557806046
}

2. POST /employee_resetpwd.do

Reset the password by auth code to given new password.

It will reset the token after each successful resetting.

request payload:

{
"account_name": "teacher_name", 
"authcode": "111111", 
"new_password": "222222"
}

json response:

{"error_code":0,"access_token":"1393763572585"}

3. POST /kindergarten/:kg/assessments

creating multiple assessment in one service call.

request payload:

[{
  "publisher":"杨老师",
  "publisher_id":"3_1234_1234",
  "comments":"我这周请假了",
  "emotion":3,
  "dining":3,
  "rest":3,
  "activity":3,
  "game":3,
  "exercise":3,
  "self_care":3,
  "manner":3,
  "child_id":"1_93740362_456",
  "school_id":93740362
},
{
  "publisher":"杨老师",
  "publisher_id":"3_1234_1234",
  "comments":"前一条我骗你的",
  "emotion":3,
  "dining":3,
  "rest":3,
  "activity":3,
  "game":3,
  "exercise":3,
  "self_care":3,
  "manner":3,
  "child_id":"1_93740362_456",
  "school_id":93740362
}
]

json response:

{"error_code":0}

4. GET /kindergarten/:kg/session?class_id=1,2,4

Batch query interface for sessions(new conversation).

parameters: class_id(mandatory)

json response:

[
{"topic":"1_93740362_1","timestamp":312314313123,"id":3,"content":"小白今天请假。","media":{"url":"","type":"image"},"sender":{"id":"2_93740362_787","type":"p"}}, 
{"topic":"1_93740362_2","timestamp":316614313663,"id":10,"content":"小明同学的情况。","media":{"url":"","type":"image"},"sender":{"id":"2_93740362_15","type":"p"}}
]

5. GET /kindergarten/:kg/dailylog?class_id=1,2,4

Batch query interface for daily check in/out log, will only output CURRENT DAY's log.

parameters: class_id(mandatory)

json response:

[
{"timestamp":1399819035409,"notice_type":1,"child_id":"2_1003_2","record_url":"http://suoqin-test.u.qiniudn.com/FoUJaV4r5L0bM0414mGWEIuCLEdL","parent_name":"白珊女"},{"timestamp":1399819038472,"notice_type":1,"child_id":"2_1003_3","record_url":"http://suoqin-test.u.qiniudn.com/FoUJaV4r5L0bM0414mGWEIuCLEdL","parent_name":"杨之梅2"}
]

6. GET /kindergarten/:kg/sender/:senderId?type=t

Query the sender information which given by chat session interface

parameters: type(mandatory): t for employee, and p for parent

json response: type=t

{"id":"3_93740362_1122","name":"王老师","phone":"15558249821","gender":0,"workgroup":"教师组","workduty":"教师","portrait":"","birthday":"1976-06-04","school_id":93740362,"login_name":"e0001","timestamp":0,"privilege_group":"principal"}

type=p

{"parent_id":"2_93740362_790","school_id":93740362,"name":"老虎","phone":"13408654683","portrait":"","gender":0,"birthday":"1799-12-31","timestamp":0,"member_status":1,"status":1,"company":"ZTE"}

7. GET /kindergarten/:kg/history/:topicId/record

POST /kindergarten/:kg/history/:topicId/record

Recording all image resources while child growing up. Similar to chat session interface, however, different in media part.

case class ChatSession(topic: String, timestamp: Option[Long], id: Option[Long], content: String, media: Option[MediaContent] = Some(MediaContent("")), sender: Sender, medium: Option[List[MediaContent]] = Some(List[MediaContent]()))

case class Sender(id: String, `type`: Option[String] = Some("t"))

case class MediaContent(url: String, `type`: Option[String] = Some("image"))

Instead of using

"media": {"url": "http://...", "type": "image"}

,in children history interface we are using:

"medium": [
{"url": "http://url1", "type": "image"},
{"url": "http://url2", "type": "image"}
]

json response:

[{"topic":"h_1_93740362_9982","timestamp":312314313133,"id":4,"content":"小孩历史测试无图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[]},{"topic":"h_1_93740362_9982","timestamp":312314313143,"id":5,"content":"小孩历史测试一张图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[{"url":"http://suoqin-test.u.qiniudn.com/FgPmIcRG6BGocpV1B9QMCaaBQ9LK","type":"image"}]},{"topic":"h_1_93740362_9982","timestamp":312314313143,"id":6,"content":"小孩历史测试三张图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[{"url":"http://suoqin-test.u.qiniudn.com/FgPmIcRG6BGocpV1B9QMCaaBQ9LK","type":"image"},{"url":"http://suoqin-test.u.qiniudn.com/FgPmIcRG6BGocpV1B9QMCaaBQ9LK","type":"image"},{"url":"http://suoqin-test.u.qiniudn.com/FgPmIcRG6BGocpV1B9QMCaaBQ9LK","type":"image"}]},{"topic":"h_1_93740362_9982","timestamp":1400513075315,"id":7,"content":"小孩历史测试三张图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[{"url":"List(MediaContent(http://suoqin-test.u.qiniudn.com/FgPmIcRG6BGocpV1B9QMCaaBQ9LK,Some(image)), MediaContent(http://suoqin-test.u.qiniudn.com/FgPmIcRG6BGocpV1B9QMCaaBQ9LK,Some(image)), MediaContent(http://suoqin-test.u.qiniudn.com/FgPmIcRG6BGocpV1B9QMCaaBQ9LK,Some(image)))","type":"image"}]}
]

8. POST /kindergarten/:kg/history?child_id=1,2,3,4

Recording one piece of content for several children.

The request is the same as history interface

{
"topic":"1_93740362_9983",
"content":"小孩历史测试无图片",
"sender":{"id":"3_93740362_1","type":"t"},
"medium":[]
}

json response:

[
{"topic":"1_93740362_9982","timestamp":1400771343108,"id":10,"content":"小孩历史测试无图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[]},

{"topic":"1_93740362_9983","timestamp":1400771343112,"id":11,"content":"小孩历史测试无图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[]},

{"topic":"1_93740362_9984","timestamp":1400771343116,"id":12,"content":"小孩历史测试无图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[]}
]

9. GET /api/v1/kindergarten/:kg/video_member

Get all parents account information who enabled video services.

example: http://localhost/api/v1/kindergarten/2088/video_member

json response:

[{
"id":"2_2088_1404306110633",
"account":"0758B3F3CD5F947A9120135C72EB115F",
"school_id":2088
}]

10. GET /api/v1/kindergarten/:kg/video_member/:parent_id

Get single parent account information who enabled video services.

example: http://localhost/api/v1/kindergarten/2088/video_member/2_2088_1404306110633

json response:

{
"id":"2_2088_1404306110633",
"account":"0758B3F3CD5F947A9120135C72EB115F",
"school_id":2088
}

11. POST /kindergarten/:kg/employee/:phone/password

Update employee's password by old one.

example: http://localhost/kindergarten/2088/employee/14043061106

request payload: scala class:

case class EmployeePassword(employee_id: String, school_id: Long, phone: String, old_password: String, login_name: String, new_password: String)
{
"employee_id": "234234234243", "school_id": 2088, "phone": "14043061106", "old_password": "hello", "login_name": "batman", "new_password": "world"
}

json response:

{"error_code": 0}

12. POST /kindergarten/:kg/admin/:adminId/news

(deprecated, use #15 please) Create news for particular school by teachers.

adminID is the teacher's employee id. class_id = 0 means publish to all classes.

request payload:

{
      "school_id" : 2114,
      "title" : "title",
      "content" : "content",
      "published" : true,
      "class_id" : 0,
      "image" : "http://image.com/image.jpg",
      "publisher_id" : "3_2114_123"
}

response:

{"news_id":447,"school_id":2114,"title":"title","content":"content","timestamp":1410426998839,"published":true,"notice_type":2,"class_id":0,"image":"http://image.com/image.jpg","publisher_id":"3_2114_123"}

13. GET /api/v2/kindergarten/:kg/news/:newsId/reader

List all parents who have given the reading feedback so far.

json response:

[{
  "school_id": 123456, 
  "name": "老王", 
  "phone": "13402995318", 
  "portrait": "http://baidu.com/image.png", 
  "gender": 0, 
  "birthday": "1980-1-1",
  "parent_id": "1_123456_321",
  "timestamp" : 1231231231231,
  "member_status": 1,
  "status": 1
},{
  "school_id": 123456, 
  "name": "老李", 
  "phone": "13402995319", 
  "portrait": "http://baidu.com/image.png", 
  "gender": 0, 
  "birthday": "1980-1-1",
  "parent_id": "1_123456_322",
  "timestamp" : 1231231231233,
  "member_status": 0,
  "status": 1
}]

13.1 /api/v2/kindergarten/:kg/news/:newsId/reader/:parentId

Almost the same as 13, but only for single parent.

response:

{
  "school_id": 123456, 
  "name": "老王", 
  "phone": "13402995318", 
  "portrait": "http://baidu.com/image.png", 
  "gender": 0, 
  "birthday": "1980-1-1",
  "parent_id": "1_123456_321",
  "timestamp" : 1231231231231,
  "member_status": 1,
  "status": 1
}

14. GET /api/v2/kindergarten/:kg/admin/:adminId/news

Show all news include published and non-published, for teachers only. API V2 will include tags field in response. parameters: class_id : can be more than one class ids, joined with a ',' restrict : combined with class_id, restrict=true means do not include all-school-scoped news in response from, to, most

15. POST /api/v2/kindergarten/:kg/admin/:adminId/news

Create news for particular school by teachers.

adminID is the teacher's employee id, must be the same as publisher_id in request payload. class_id = 0 means publish to all classes.

payload:

{
      "school_id" : 2114,
      "title" : "title",
      "content" : "content",
      "published" : true,
      "class_id" : 0,
      "image" : "http://image.com/image.jpg",
      "publisher_id" : "3_2114_123",
      "tags": ["作业", "活动"]
}

16. POST /api/v2/kindergarten/:kg/admin/:adminId/news/:newsId

Update news. adminID is the teacher's employee id, must be the same as publisher_id in request payload.

payload:

{
      "school_id" : 2114,
      "title" : "title",
      "content" : "content",
      "published" : true,
      "class_id" : 0,
      "image" : "http://image.com/image.jpg",
      "publisher_id" : "3_2114_123",
      "tags": ["作业"]
}

17. DELETE /api/v2/kindergarten/:kg/admin/:adminId/news/:newsId

Delete given news.

no payload is required.

Clone this wiki locally