8.2.3 数据集基础信息
1. 获取用户项目列表
接口定义
请求方式:GET
请求URL:$home_url/universe/public-api/projects
home_url需要填入对应环境的IP/域名,eg: http://u.guandata.com
请求参数
Name | Location | 类型 | 含义 | 必填 | 备注 |
Content-Type | Header | String | 内容类型 | 是 | application/json;charset=utf-8 |
token | Header | String | 登录用的Token | 是 | 调用登录校验API获取(8.1 登录校验) |
接口调用示例
Header 示例
{
"Content-Type": "application/json; charset=utf-8",
"token": "ab7f1665-8dfc-4d8f-928d-c7a5aefc9332" //登录接口获得的Token
}
Response
//获取数据成功
{
"code":0,
"msg":"success",
"data":[
{
"id": 1,
"name", "default",
"createTime": "2021-01-12T07:49:51.000+0000",
"updateTime": "2021-01-12T07:49:51.000+0000"
},
{
"id":2,
"name":"project2",
"createTime": "2021-01-12T07:49:51.000+0000",
"updateTime": "2021-01-12T07:49:51.000+0000"
}
]
}
2. 获取指定项目数据集列表
接口定义
请求方式:GET
请求URL:$home_url/universe/public-api/projects/{projectId}/datasets
home_url需要填入对应环境的IP/域名,eg: http://u.guandata.com
请求参数
Name | Location | 类型 | 含义 | 必填 | 备注 |
Content-Type | Header | String | 内容类型 | 是 | application/json;charset=utf-8 |
token | Header | String | 登录用的Token | 是 | 调用登录校验API获取(8.1 登录校验) |
接口调用示例
Header 示例
{
"Content-Type": "application/json; charset=utf-8",
"token": "ab7f1665-8dfc-4d8f-928d-c7a5aefc9332" //登录接口获得的Token
}
Response
//获取数据成功
{
"code":0,
"msg":"success",
"data":[
{
"id": 1,
"name", "ds1",
"rowCount": 100,
"colCount": 10,
"createTime": "2021-01-12T07:49:51.000+0000",
"updateTime": "2021-01-12T07:49:51.000+0000"
},
{
"id":2,
"name":"ds2",
"rowCount": 200,
"colCount": 10,
"createTime": "2021-01-12T07:49:51.000+0000",
"updateTime": "2021-01-12T07:49:51.000+0000"
}
]
}
3. 获取指定项目数据集列表(含目录)
接口定义
请求方式:GET
请求 URL:$home_url/universe/public-api/projects/{projectId}/datasets/structure
home_url需要填入对应环境的IP/域名,eg: http://u.guandata.com
请求参数
Name | Location | 类型 | 含义 | 必填 | 备注 |
Content-Type | Header | String | 内容类型 | 是 | application/json;charset=utf-8 |
token | Header | String | 登录用的Token | 是 | 调用登录校验API获取(8.1 登录校验) |
返回示例
结果按照目录层级排序,同级目录遵从字典序,目录结构见字段 dirPath
{
"code": 0,
"msg": "success",
"data": [
{
"id": 10,
"name": "one",
"userId": 8,
"userName": null,
"updateUserId": 8,
"updateUserName": null,
"projectId": 1,
"rowCount": 37748736,
"colCount": 19,
"createTime": "2022-10-17T16:10:51.000+08:00",
"updateTime": "2022-10-17T17:34:04.000+08:00",
"description": "",
"dirId": null,
"status": "FINISHED",
"version": 22,
"dataVersion": 23,
"fields": null,
"projectName": null,
"externalDataPath": null,"dirPath": ["根目录"],
"primaryKeys": "[]",
"partitionKeys": "[]",
"sourceType": "PROCESS",
"datasetCenterRelationType": null,
"aiDatasetType": null,
"message": null,
"format": "delta",
"del": false,
"fullDataPath":"delta/10/output/task_result_data_parquet"
},
{
"id": 34,
"name": "数据集 1",
"userId": 3,
"userName": null,
"updateUserId": 3,
"updateUserName": null,
"projectId": 1,
"rowCount": 506,
"colCount": 15,
"createTime": "2022-11-07T17:05:14.000+08:00", "updateTime": "2022-11-07T17:05:14.000+08:00", "description": null,
"dirId": 8,
"status": "FINISHED",
"version": 0,
"dataVersion": 1,
"fields": null,
"projectName": null,
"externalDataPath": null,
"dirPath": [
"根目录",
"1" ],
"primaryKeys": "[]",
"partitionKeys": "[]",
"sourceType": "FILE",
"datasetCenterRelationType": null,
"aiDatasetType": null,
"message": null,
"format": "delta",
"del": false,
"fullDataPath":"delta/34/output/task_result_data_parquet"
}
],
"errorDetail": null
}
4. 获取数据集详情
接口定义
请求方式:GET
请求URL:$home_url/universe/public-api/projects/{projectId}/datasets/{datasetId}
home_url需要填入对应环境的IP/域名,eg: http://u.guandata.com
请求参数
Name | Location | 类型 | 含义 | 必填 | 备注 |
Content-Type | Header | String | 内容类型 | 是 | application/json;charset=utf-8 |
token | Header | String | 登录用的Token | 是 | 调用登录校验API获取(8.1 登录校验) |
接口调用示例
Header 示例
{
"Content-Type": "application/json; charset=utf-8",
"token": "ab7f1665-8dfc-4d8f-928d-c7a5aefc9332" //登录接口获得的Token
}
Response
//获取数据成功
{
"code":0,
"msg":"success",
"data":
{
"id": 1,
"name", "ds1",
"rowCount": 100,
"colCount": 10,
"createTime": "2021-01-12T07:49:51.000+0000",
"updateTime": "2021-01-12T07:49:51.000+0000",
"fields": [
{
"name": "id",
"type": "INTEGER",
"comment": "comment"
},
{
"name": "u_id",
"type": "STRING",
"comment": null
}
]
}
}
5. 查询数据集(后续分页获取数据集数据的前置调用)
接口定义
请求方式:POST
请求URL:$home_url/universe/public-api/projects/{projectId}/datasets/{datasetId}/export-to-avro
home_url需要填入对应环境的IP/域名,eg: http://u.guandata.com
请求参数
Name | Location | 类型 | 含义 | 必填 | 备注 |
Content-Type | Header | String | 内容类型 | 是 | application/json;charset=utf-8 |
token | Header | String | 登录用的Token | 是 | 调用登录校验API获取(8.1 登录校验) |
sql | body | String | 查询sql,为空表示获取数据集全部数据 | 否 |
Response
//获取数据成功
{
"code": 0,
"msg": "success",
"data": "/avro_temp/preview_b5fb68125ac74fdf892b96acdaf06fbe_main_output/part-00000-bdedd42a-833f-47f5-b740-c6a4c8b9ff1e-c000.avro"
}
6. 分页获取数据集
接口定义
请求方式:POST
请求URL:$home_url/universe/public-api/projects/{projectId}/datasets/{datasetId}/retrieve-avro-result
home_url需要填入对应环境的IP/域名,eg: http://u.guandata.com
请求参数
Name | Location | 类型 | 含义 | 必填 | 备注 |
Content-Type | Header | String | 内容类型 | 是 | application/json;charset=utf-8 |
token | Header | String | 登录用的Token | 是 | 调用登录校验API获取(8.1 登录校验) |
filePath | Body | String | 上面查询数据集接口返回的data | 是 | |
offset | Body | String | 数据起始位置 | 是 | |
limit | Body | Integer | 读取的数量 | 是 |
Response
//获取数据成功
{
"code": 0,
"msg": "success",
"data": {
"columns": [ //列信息
{
"name": "id",
"type": "INTEGER",
"comment": null
},
{
"name": "name",
"type": "STRING",
"comment": null
}
],
"preview": [ //数据
[
"493",
"中文表头-替换数据的副本-T13939"
],
[
"461",
"日期格式+计算格式"
]
],
"hasMore": false //hasMore:是否还有数据(false表示数据已经全部获取完毕;true表示可能还有数据未取完,注意下次请求的数据可能为空)
}
}