UniConnector平台 - REST API设计

API地址

https://api.uniconnector.com

Token设计

存在Header中
UniConnector-Token: JWT (appId +appKey+ 时间戳)

查询URL体

/tablename POST 插入一条记录
/tablename/pkId  GET 读取指定Id记录
/tablename/pkId PUT 更新指定Id记录
/tablename GET 查询数据表内所有记录
/tablename?key=value&key1=value1 GET 按key、value条件查询符合的记录
/tablename/relation GET 查询多表联合的记录(table、joinon、where必选)
/tablename/pkId DELETE 删除一条记录
/tablename DELETE 删除多条记录(where必选)

 

条件JSON体

table 数据表

{"tables":"employee a left join friends b"}

joinon 多表连接条件

{"joinon"," on a.id = b.id "}

fields 字段选择

// 查询所有列
{"fields":"*"} 或 不传fields字段

//查询指定列
{"fields":"id,name,age"}

page 分页逻辑(不同数据库不一样,特殊处理)


{"perpage" : "每页几条"}
{"curpage" : "当前第几页"}
{"totalpages" : "总共页数"}

where 过滤


{"where":"a.id = b.id and a.name='tom' and b.age=18"}


order 排序


{"order":"a.id desc,b.id desc"}


运算、比较操作符,在where中直接使用sql语法
连接关系, 通过where 和 joinon解决

扫描二维码关注公众号,回复: 8480111 查看本文章

猜你喜欢

转载自www.cnblogs.com/jerryqm/p/11556123.html