(→列出版面) |
(→版面) |
||
第27行: | 第27行: | ||
== 版面 == | == 版面 == | ||
+ | BoardInfo: | ||
+ | <source lang="javascript"> | ||
+ | { | ||
+ | "name": <string: Board name>, | ||
+ | "read": <Boolean: Board read?>, | ||
+ | "BM": <string: BMs>, | ||
+ | "id": <int: Board id>, | ||
+ | "total": <int: Total post count>, | ||
+ | "currentusers": <int: Current users count>, | ||
+ | "major": <int: major class>, | ||
+ | "minor": <string: minor class>, | ||
+ | "outpost": <string: may outpost>, | ||
+ | "desc": <string: description>} | ||
+ | } | ||
+ | </source> | ||
* 帖子列表模式(通常以mode参数出现): | * 帖子列表模式(通常以mode参数出现): | ||
第78行: | 第93行: | ||
|} | |} | ||
* Return value | * Return value | ||
− | ** Success: | + | ** Success: |
− | + | <source lang="javascript"> | |
+ | [ | ||
+ | <PostInfo: information of one post>, | ||
+ | ... | ||
+ | ] | ||
+ | </source> | ||
=== 清除未读标记 === | === 清除未读标记 === |
2012年7月6日 (五) 20:33的版本
目录
数据类型
AttachInfo:
{
"name": <string: Attachment filename>,
"offset:": <int: Attachment offset in post>
}
JSONP
Parameter | Type | Description | Optional |
---|---|---|---|
jsonp | string | JSONP function name | Yes |
jsoncallback | string | JSONP function name | Yes |
If you want JSONP, just add jsonp=function, and the result would be
function(data);
登录
版面
BoardInfo:
{
"name": <string: Board name>,
"read": <Boolean: Board read?>,
"BM": <string: BMs>,
"id": <int: Board id>,
"total": <int: Total post count>,
"currentusers": <int: Current users count>,
"major": <int: major class>,
"minor": <string: minor class>,
"outpost": <string: may outpost>,
"desc": <string: description>}
}
- 帖子列表模式(通常以mode参数出现):
- normal: 普通模式
- digest: 文摘模式
- mark: 被m模式
- thread: 同主题模式
- origin: 原作模式
- sticky: 置顶模式
列出版面
- GET /board/list
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
start | int | ID of the first post to list | Yes |
end | int | ID of the last post to list | Yes |
count | int | Number of posts to list | Yes |
- Return value
- Success:
[
<BoardInfo: information of one board>,
...
]
获取帖子列表
- GET /board/post_list
Parameter | Type | Description | Optional | Choices |
---|---|---|---|---|
session | string | Session Token | No | |
name | string | Name of the board to list | No | |
mode | string | Mode of this board to list | Yes | 帖子列表模式 |
start | int | ID of the first post to list | Yes | |
end | int | ID of the last post to list | Yes | |
count | int | Number of posts to list | Yes |
- Return value
- Success:
[
<PostInfo: information of one post>,
...
]
清除未读标记
- POST /board/clear_unread
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
name | string | Name of the board to list | No |
to | int | unique ID (xid) of the post to clear to | Yes |
如果不提供to参数,则清除所有。否则清楚从开始到指定帖子的未读标记。
帖子
获取帖子
- GET /post/view
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
id | int | ID of the post in this board | No |
board | string | Name of the board this post belongs to | No |
- Return value
- Success:
{
"picattach": [
<AttachInfo: information of one attachment>,
...
],
"otherattach": [
<AttachInfo: information of one attachment>,
...
],
"title": <string: Post title>,
"content": <string: Post content>,
"owner": <string: Poster>,
"id": <int: Post ID>,
"xid": <int: unique post ID>
}
获取附件
- GET /post/get_attach
Parameter | Type | Description | Optional | Choices |
---|---|---|---|---|
session | string | Session Token | No | |
id | int | ID of the post in this board | No | |
board | string | Name of the board this post belongs to | No | |
mode | string | Mode of the board this ID corresponds to | Yes | 帖子列表模式 |
offset | int | Offset of the attachment in the post, returned in "view" | No |
- Result value
- {"content": <string: Post content encoded in Base64>, "name": <string: Attachment name>}
同主题浏览
- GET /post/nextid
Parameter | Type | Description | Optional | Choices |
---|---|---|---|---|
session | string | Session token | No | |
id | int | Post ID to start search from | No | |
board | string | Board name | No | |
direction | string | Search direction | Yes | forward/backward |
last_one | bool | Search for the last post | Yes | 0/1 |
only_new | bool | Only search for new post | Yes | 0/1 |
- Result
- {'nextid': <int: next post id in the thread>}
- Examples
- direction=forward: search for next post in the same thread
- direction=backward, last_one=1: go to the head of the thread
- direction=backward, last_one=1, only_new=1: go to the first unread post in the thread
引用帖子
- GET /post/quote
Parameter | Type | Description | Optional | Choices |
---|---|---|---|---|
session | string | Session Token | No | |
board | string | Name of the board this post belongs to | No | |
id | int | ID of the post to quote | No | |
xid | int | unique ID of the post to quote | No | |
mode | string | quote mode | Yes | S/R/N/A |
index_mode | string | mode of the post list where ID belongs to | Yes | 帖子列表模式 |
- Result
- {"title": <string: Quoted title>, "content": <string: Quoted content>}
准备
- GET /post/prepare
Parameter | Type | Description | Optional | Choices |
---|---|---|---|---|
session | string | Session Token | No | |
for | string | action to prepare for | No | new |
board | string | Name of the board this post belongs to | No | |
re_id | int | ID of the post to reply (for=new) | Yes | |
re_xid | int | unique ID of the post to reply (for=new) | Yes | |
re_mode | string | mode of the post list where re_id belongs to (for=new) | Yes | 帖子列表模式 |
anonymous | boolean | create anonymous post (for=new) | Yes | 0(no)/1(yes) |
result: {"error": {<string: error>: 1}} 如果没错误,那后面的hash是空的。
发帖/回帖
- POST /post/new
Parameter | Type | Description | Optional | Choices |
---|---|---|---|---|
session | string | Session Token | No | |
board | string | Name of the board this post belongs to | No | |
re_id | int | ID of the post to reply | Yes | |
re_xid | int | unique ID of the post to reply | Yes | |
re_mode | string | mode of the post list where re_id belongs to | Yes | 帖子列表模式 |
title | string | title of the post | No | |
content | string | content of the post | No | |
signature_id | int | No. of qmd to use | Yes | <0(random)/0(none)/>0(qmd #) |
anonymous | boolean | create anonymous post | Yes | 0(no)/1(yes) |
mailback | boolean | require replies to be mailed back | Yes | 0(no)/1(yes) |
发帖的话,id和xid可以忽略。回帖的话,需要提供id和xid。
收藏夹
列出收藏夹
- GET /favboard/list
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
father | int | Parent directory of boards to list | Yes |
start | int | ID of the first post to list | Yes |
end | int | ID of the last post to list | Yes |
count | int | Number of posts to list | Yes |
- Return value
- Success: [{"index": <int: Index in favboard>, "binfo": <BoardInfo: board info>, "father": <int: Parent index in favboard>, "type": <string: Type of this entry>}, {...}...]
会话
验证会话
- GET /session/verify
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
精华区
DigestItem:
{
'mtitle': <string: menu title when listing children of this item>,
'title': <string: title of this item>,
'attach': <int: attachment position or attachment flag, with attachment <-> != 0>,
'mtime': <int: modification time>,
'type': <string: item type. can be file/dir/link/other>,
'id': <int: item index, start from 1>,
// these items only appear if type == link
'host': <string: link host>,
'post': <int: link port>
}
列出目录
- GET /digest/list
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
board | string | Board name of the digest. If not present, start from the Digest menu. | Yes |
route | string | Route to the directory. Like x-1-2-3 | No |
start | int | Number of the first item | Yes |
end | int | Number of the last item | Yes |
Result:
{
'parent': <DigestItem: information of the directory>,
'count': <int: number of items returned>,
'items': [
<DigestItem: information of one item>,
...
]
}
获取帖子
- GET /digest/view
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
board | string | Board name of the digest. If not present, start from the Digest menu. | Yes |
route | string | Route to the post. Like x-1-2-3 | No |
Result:
{
'item': <DigestItem: information of the post item>,
'content': <string: content of the post>,
'picattach': [
<AttachmentInfo: information of one attachment>,
...
],
'otherattach': [
<AttachmentInfo: information of one attachment>,
...
]
}
用户
获取用户信息
- GET /user/query
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
id | string | ID of user to query | No |
获取默认签名档编号
- GET /user/signature_id
Parameter | Type | Description | Optional |
---|---|---|---|
session | string | Session Token | No |
- Return value:
{"signature_id": <int: default signature id>}