Skip to content
Insane edited this page Sep 9, 2015 · 1 revision

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


GET https://stage2.cocobabys.com/kindergarten/1003/history/1_1396844597394/record

topicId是小孩id from=起始id,不包括 to=结束id,不包括

[
{"topic":"1_93740362_9982","timestamp":1397131200000,"id":1,"content":"2014年4月发一条成长记录","sender":{"id":"2_93740362_792","type":"p"},"medium":[{"url":"http://kulebao-prod.qiniudn.com/%252F3_0_1%252Fimage.jpg","type":"image"}]},{"topic":"1_93740362_9982","timestamp":1401150055960,"id":6,"content":"小孩历史测试无图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[]},{"topic":"1_93740362_9982","timestamp":1401160055960,"id":7,"content":"小孩历史测试一张图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[{"url":"http://kulebao-prod.qiniudn.com/%252F3_0_1%252Fimage.jpg","type":"image"}]},{"topic":"1_93740362_9982","timestamp":1401170055960,"id":8,"content":"小孩历史测试三张图片","sender":{"id":"2_93740362_790","type":"p"},"medium":[{"url":"http://kulebao-prod.qiniudn.com/%252F3_0_1%252Fimage.jpg","type":"image"},{"url":"http://kulebao-prod.qiniudn.com/%252F3_0_1%252Fimage.jpg","type":"image"},{"url":"http://kulebao-prod.qiniudn.com/%252F3_0_1%252Fimage.jpg","type":"image"}]}
]

senderid是发送者的id,可以是parent_id或者employee_id,sendertype是't'(老师)或者'p'(家长)。创建时默认为't'。 可以通过employee接口查询老师的信息

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


POST https://stage2.cocobabys.com/kindergarten/1003/history/1_1396844597394/record

request payload:

{
"topic":"1_1396844597394",
"content":"我发一张图片一段录音",
"medium":[{"url":"http://suoqin-test.u.qiniudn.com/FgPmIcRG6BGocpV1B9QMCaaBQ9LK","type":"image"}, {"url":"http://suoqin-test.u.qiniudn.com/13.amr","type":"audio"}],
"sender":{"id":"2_1003_1396844438388","type":"p"}
}

参数retrieve_recent_from保证服务器在收到新消息时直接返回最近的25条信息。工作原理是: 例:retrieve_recent_from=100 POST https://www.cocobabys.com/kindergarten/93740362/history/123456789/record?retrieve_recent_from=100 返回的结果为:返回服务器端包括最新创建的信息(假设编号为120)在内的,从id=101开始到id=120的信息,id从大到小排列,如果符合条件的信息超过25条只返回25条,因此可能新创建的信息不会返回。

Clone this wiki locally