wiki:API/BBS/Get-All-Posts-From-Specify-Topic

Table of Contents

  1. Params
  2. Note
  3. Example

获取指定话题的所有帖子;

获取指定话题里某用户的所有帖子。

URL PCAuto:  http://mrobot.pcauto.com.cn/proxy/bbs/topics/$topic_ID
PCOnline:  http://mrobot.pconline.com.cn/v2/itbbs/topics/$TOPIC_ID
response MIME text/html

Params

name required desc
pageNo n 分页第几页
pageSize n
authorId  n 只查看某 author ID 发表的所有帖子

Note

response MIME 为 text/html ,不是 application/json ;分页信息隐含在 response headers 里。

example

curl http://mrobot.pconline.com.cn/v2/itbbs/topics/587012 -D /tmp/foo-header.txt
cat /tmp/foo-header.txt
HTTP/1.1 200 OK
Server: nginx/0.8.42
Date: Wed, 04 May 2011 10:19:44 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Page: 1,91
X-Page 当前第几页,共有多少个帖子

客户端分页时,必须要作如下设置

PAGINATION_SIZE 10 # 每页里面有多少个 posts

splits = X-Page.split(",")
current_page_num = splits[0]
total_page = splits[1] # 一共有多少页

Example

curl  http://mrobot.pconline.com.cn/v2/itbbs/topics/587012
curl  http://mrobot.pconline.com.cn/v2/itbbs/topics/587012?pageNo=2&pageSize=5
curl  http://mrobot.pconline.com.cn/v2/itbbs/topics/587012?authorId=32726