跳到主要内容

列出项目数据表

列出项目当中的数据表信息

请求

curl -vvv "$API_HOST/open/api/v1/projects/$project_id/tables/" -H "Authorization: $access-token"

Python 示例


def list_project_table(access_token, project_id):
url = '%s/open/api/v1/projects/%d/tables/' % (API_HOST, project_id)
headers = {'Authorization': access_token}
req = requests.get(url, headers=headers)
return req.json()


# get first project in workspace
workspace = ma.openapi_list_workspaces(access_token)["detail"][0]
ws_detail = ma.get_workspace_detail(access_token, workspace)
project = ws_detail['detail']['detail']['projects'][0]

resp = ma.list_project_table(access_token, project["id"])


响应

NameTypeDescription
detailarrayProject table list
∟ idint64table id
∟ namestringtable name
∟ typestringtable type
∟ columnsarraytable columns info

响应体示例

{
"code": 0,
"detail": [
{
"id": 73,
"type": "table",
"name": "新建数据表",
"columns": [
{
"id": "645d87151694c57ce7af57c1",
"name": "标题",
"type": "multiLineText",
"typeOptions": null,
"isPrimary": true,
"mode": "normal",
"desc": null,
"meta": {
"createTime": "2023-05-12T00:23:49.742Z",
"updateTime": "2023-05-12T00:23:49.742Z",
"creatorID": 1,
"updaterID": 1
}
},
{
"id": "645d87151694c57ce7af57c2",
"name": "日期",
"type": "datetime",
"typeOptions": {
"dateFormat": "year/month/day",
"quantiles": null,
"timeFormat": "hidden"
},
"isPrimary": false,
"mode": "normal",
"desc": null,
"meta": {
"createTime": "2023-05-12T00:23:49.742Z",
"updateTime": "2023-05-12T00:23:49.742Z",
"creatorID": 1,
"updaterID": 1
}
},
{
"id": "645d87151694c57ce7af57c3",
"name": "坐标",
"type": "coordinate",
"typeOptions": null,
"isPrimary": false,
"mode": "normal",
"desc": null,
"meta": {
"createTime": "2023-05-12T00:23:49.743Z",
"updateTime": "2023-05-12T00:23:49.743Z",
"creatorID": 1,
"updaterID": 1
}
},
{
"id": "645d87151694c57ce7af57c4",
"name": "单选",
"type": "singleChoice",
"typeOptions": {
"choices": []
},
"isPrimary": false,
"mode": "normal",
"desc": null,
"meta": {
"createTime": "2023-05-12T00:23:49.743Z",
"updateTime": "2023-05-12T00:23:49.743Z",
"creatorID": 1,
"updaterID": 1
}
},
{
"id": "645d87151694c57ce7af57c5",
"name": "数值",
"type": "number",
"typeOptions": {
"format": "number",
"precision": 2,
"quantiles": null
},
"isPrimary": false,
"mode": "normal",
"desc": null,
"meta": {
"createTime": "2023-05-12T00:23:49.743Z",
"updateTime": "2023-05-12T00:23:49.743Z",
"creatorID": 1,
"updaterID": 1
}
},
{
"id": "645d87151694c57ce7af57c6",
"name": "附件",
"type": "attachment",
"typeOptions": null,
"isPrimary": false,
"mode": "normal",
"desc": null,
"meta": {
"createTime": "2023-05-12T00:23:49.744Z",
"updateTime": "2023-05-12T00:23:49.744Z",
"creatorID": 1,
"updaterID": 1
}
}
]
}
],
"extra": null,
"message": "OK",
"requestID": null
}