API地址
https://d.uniconnector.com
Token设计
Header:
X-Uniconnector-Api-Key : {{ 订阅成功后,生成的Api-Key }}
查询URL体
| URL | Method | 功能 |
| /tablename | POST | 插入一条记录 |
| /tablename/pkId | GET | 读取指定Id记录 |
| /tablename/pkId | PUT | 更新指定Id记录 |
| /tablename | GET | 查询数据表内所有记录 |
| /tablename/relation | GET | 查询一对一,一对多表联合的记录 |
| /tablename/pkId | DELETE | 删除一条记录 |
| /tablename | DELETE | 删除多条记录 |
条件JSON体
fields 字段选择
// 查询指定列(不传fields,查询所有列)
{
"fields": { "id" , "name", "age"}
}
page 分页逻辑
{
"limit" : 10, //取出10条记录
"skip" : 20 //从第20条记录开始
}
where 过滤
{
"where": { "id" : 10, "name": "tom" , "age: 18 }
}
order 排序
{
"order": "createDate desc"
}
and 逻辑与
{
"where": {
"and": [
{"id" : 10},
{"name": "tom" },
{ "age": 18}
]
}
}
or 逻辑或
{
"where": {
"or": [
{"id" : 10},
{"name": "tom" },
{ "age": 18}
]
}
}
gt 大于(>) , gte 大于或等于(> =) ,lt 小于(<), lte 小于或等于(< =), ne 不等于(!=)
{
"where": {
"price": {"gt": 100},
"price": {"lt": 500}
}
}
between 在…之间
{
"where": {
"price":{
"between": [100, 500]
}
}
}
inq,nin 在/不在一个数组之内
{
"where":{
"id": {"inq": [10, 11, 12]}
}
}
like,nlike like/not like 操作符返回符合正则表达式的数据
{
"where":{
"title":{ "like": "中国%" },
"name":{ "nlike": "微服务%" }
}
}
例子: 查询开户行在工商银行icbc,公司地址为95 Street的注册公司名称和经营范围描述,按注册日期倒序排序,从第20条记录开始,取出10条记录。
var filter = {
"fields":{"name", "description"},
"where":{"bank": "icbc", "address": "95 Street "},
"order": "createDate DESC",
"limit": 10,
"skip":20
}
$.ajax({
"url": "https://d.uniconnector.com/api/Company?filter=" + encodeURIComponent(JSON.stringify(filter)),
"type": "GET",
"headers": {
"X-UniConnector-APIKey": "{{API_key}}"
}
}).done(function (data, status, header) {
//成功回调方法
}).fail(function (header, status, errorThrown) {
//失败回调方法
})