有数自定义API使用的简单案列

  1. 带 * 为必填/必传
  2. 你需要在本地完成test tables tablemeta tabledata 的创建,有数将会完成数据的解析
  3. 一般不推荐使用自定义API,如确实有需求请使用RESTAPI。RESTAPI更加简单,也更加稳定。

有数界面输入

url * String
username String
password String
parameters json object | json array

第三方需要实现的REST API接口(1.0版本)

说明:
rest接口统一用post方法
返回body统一为code,result,message结构。code200为正常,需返回result;否则需返回message
调用超时时间为10分钟

接口列表:

test

tables

tablemeta

tabledata

url/test

input

{

"username": "xxx",

"password": "xxx",

"parameters": json object | json array

}

output

{

"code": 200, \*

"result": {

// apiVersionAPI数据源接口版本,这里需要固定返回1.0

"apiVersion": "1.0", \*

// name为第三方实现的API数据源的名字

"name": "xxx"

}

or

"message": "xxx"

}
url/tables

input

{

"username": "xxx",

"password": "xxx",

"parameters": json object | json array

}

output

{

"code": 200, \*

"result": \["xxx", "xxx", "xxx"\]

or

"message": "xxx"

}
url/tablemeta

input

{

"username": "xxx",

"password": "xxx",

"parameters": json object | json array,

"tableName": "xxx" \*

}

output

{

"code": 200, \* // 输入不存在的tablenamecode需要返回411

"result": {

"names": \["xxx", "xxx", "xxx"\], \*

// types数组中的值,只能是以下的5种之一,区分大小写

// String 字符串 | Whole 整数 | Decimal 小数 | Date 日期 | DateTime 日期时间

"types": \["Whole", "String", "DateTime"\] \*

}

or

"message": "xxx"

}
url/tabledata

input

{

"username": "xxx",

"password": "xxx",

"parameters": json object | json array,

"selectFields": \[

{

"tableName": "xxx",

"fieldName": "xxx"

},

...
{

"tableName": "xxx",

"fieldName": "xxx"

}

\],

"tableName": "xxx" \*

}

output

{

"code": 200, \* // 输入不存在的tablenamecode需要返回411

"result": {

"names": \["xxx", "xxx", "xxx", "xxx", "xxx", "xxx"\], \*

// types数组中的值,只能是以下的5种之一,区分大小写

// String 字符串 | Whole 整数 | Decimal 小数 | Date 日期 | DateTime 日期时间

"types": \["Whole", "String", "Date", "DateTime"\] \*

// dataDateDateTime类型的数据按照yyyy-MM-dd HH:mm:ss返回,时间用24小时制

// 时间时区使用东八区

"data": \[ \*

\[123, "xxx", "1990-01-01", "1990-01-01 00:00:00"\],

...

\[123, "xxx", "1990-01-01" ,"1990-01-01 23:00:00"\]

\]

}

or

"message": "xxx"

}`