1 changed files with 18 additions and 1 deletions
@ -1,3 +1,20 @@ |
|||||||
# jsy-api-datasource-demo |
# jsy-api-datasource-demo |
||||||
|
|
||||||
API数据源示例 |
API数据源示例 |
||||||
|
|
||||||
|
```java |
||||||
|
Authentication authentication = new Authentication("#key", "#secret"); |
||||||
|
DatasourceOperation operation = new DatasourceOperation(authentication); |
||||||
|
operation.open(); |
||||||
|
// 创建一个分组,如果已经存在,则直接跳过 |
||||||
|
operation.createGroup("TestGroup"); |
||||||
|
// 在分组下创建一个表,返回创建的表的ID,如果表已经存在,则直接返回表ID |
||||||
|
String tableId = operation.createTable("HelloTable", "TestGroup"); |
||||||
|
// 获取上传文件的url |
||||||
|
String fileUploadUrl = operation.requestUploadUrl(tableId); |
||||||
|
// 将数据文件上传 |
||||||
|
HttpKits.upload(fileUploadUrl, new File(System.getProperty("user.dir") + "/data/地区数据分析.csv")); |
||||||
|
// 标记该表的数据已经上传完成 |
||||||
|
operation.markAsFinish(tableId); |
||||||
|
|
||||||
|
``` |
Loading…
Reference in new issue