{% extends base.html %} {% block content %} {% if handler.request.path == '/table' %}
method | path | description | parameters | |
---|---|---|---|---|
GET | /table/name | 展示名为name的表 可选参数如右所述 |
||
sort | 使用哪个字段排序,默认为插入顺序倒叙 | |||
order | 顺序还是倒叙,默认为倒叙 | |||
page | 当前页数,默认为1 | |||
count | 每一页显示多少项,默认为20 | |||
f | 当f=json时,返回json格式数据,可用于获取标注结果 | |||
POST | /table/name | 新增名为name的表 body为json格式,其字段类型描述如右所述 |
||
fields | 有哪些字段以及其类型 | |||
docs | 表示所有文档,为一个list,成员为dict | |||
search | 表示为哪些字段提供搜索 | |||
mark | key哪个字段用于标记,value可取哪些值,unique结果是否唯一 如可选多个值并且docs字段内有值,其必须为list类型 |
|||
DELETE | /table/name | 删除名为name的表 |
用于展示表格或者标注服务
data='{
"fields": ["id:int", "title:str", "publish_time:datetime", "tag:int"],
"docs": [{"id": 1, "title":"hello", "publish_time": "2017-01-01 10:00:00" }],
"search": ["id", "title", "publish_time"],
"mark": [{"key": "tag", "value": [0, 1, 2], "unique": false}]
}'
curl -XPOST {{ handler.scheme }}://{{ handler.host }}/table/test -d $data
name | date | action |
---|---|---|
{{ doc.name }} | {{ doc.date }} |
{{ field }} | {% end %} {% end %} {% for mark in handler.args.marks %}{{ mark['key'] }} | {% end %}
---|---|
{% raw entry.get(field, 'hello') %} | {% end %} {% end %} {% for mark in handler.args.marks %}{% for value in mark['value'] %} {% end %} | {% end %}