跳到主要内容

创建数据表视图

请求

curl -vvv "$API_HOST/open/api/v1/tablenodes/$table_id/views/" -H "Content-Type: application/json" -H "Authorization: $access-token"  -d '$request_body'

请求体

{
"fromViewID": "645d87141694c57ce7af57c0",
"name": "newView",
"type": "table"
}

参数说明

NameTypeDescriptionRequired
fromViewIDstringsource view idY
nameint64view nameY
typestringview type: table, formY

Python 示例

def create_table_view(access_token, table_id, source_view_id, name, type="table"):
url = '%s/open/api/v1/tablenodes/%d/views/' % (API_HOST, table_id)
headers = {'Authorization': access_token}
data = {
"name": name,
"fromViewID": source_view_id,
"type": type
}
req = requests.post(url, headers=headers, json=data)
return req.json()

响应

NameTypeDescription
detailobjectcreated view info
∟ projectIDint64project id
∟ tableNodeIDint64table id
∟ viewobjectview info

视图信息

NameTypeDescription
viewobjectview info
∟ allowSubscribeboolwhether allow subscribe
∟ backgroundColorstringbackground color
∟ columnsarrayview columns info
∟ descstringview description
∟ disableShareExportboolwhether disable share export
∟ filterConditionstringfilter condition
∟ filtersarrayview filters
∟ frozenColumnCountint64frozen column number
∟ groupsarrayview groups
∟ idint64view id
∟ isSharedboolwhether shared
∟ namestringview name
∟ orderint64view order
∟ ordersarrayview group order
∟ rowHeightstringrow height: low, middle, high
∟ rowsarrayrows info
∟ sharePasswordstringshare password
∟ shareTokenstringshare token
∟ subscriberCountint64subscriber number
∟ typearraytype : table, form
∟ useSharePasswordboolwhether user share password

响应示例

{
"code": 0,
"detail": {
"projectID": 16,
"tableNodeID": 73,
"view": {
"allowSubscribe": false,
"backgroundColor": "",
"columns": [
{
"desc": null,
"id": "645d87151694c57ce7af57c2",
"isHidden": false,
"order": 2,
"required": false,
"statsOption": null,
"title": null,
"width": 200
},
{
"desc": null,
"id": "645d87151694c57ce7af57c1",
"isHidden": false,
"order": 1,
"required": false,
"statsOption": null,
"title": null,
"width": 200
},
{
"desc": null,
"id": "645d87151694c57ce7af57c3",
"isHidden": false,
"order": 3,
"required": false,
"statsOption": null,
"title": null,
"width": 200
},
{
"desc": null,
"id": "645d87151694c57ce7af57c5",
"isHidden": false,
"order": 5,
"required": false,
"statsOption": null,
"title": null,
"width": 200
},
{
"desc": null,
"id": "645d87151694c57ce7af57c6",
"isHidden": false,
"order": 6,
"required": false,
"statsOption": null,
"title": null,
"width": 200
},
{
"desc": null,
"id": "645d87151694c57ce7af57c4",
"isHidden": false,
"order": 4,
"required": false,
"statsOption": null,
"title": null,
"width": 200
}
],
"desc": "",
"disableShareExport": false,
"filterCondition": "and",
"filters": null,
"frozenColumnCount": 1,
"groups": null,
"id": "645f3d0e4444eb50dc9d63af",
"isShared": false,
"name": "newView",
"order": 3,
"orders": null,
"rowHeight": "low",
"rows": [
{
"id": "645d87151694c57ce7af57ca",
"order": 4
},
{
"id": "645d87151694c57ce7af57cc",
"order": 6
},
{
"id": "645d87151694c57ce7af57c9",
"order": 3
},
{
"id": "645d87151694c57ce7af57ce",
"order": 8
},
{
"id": "645d87151694c57ce7af57cb",
"order": 5
},
{
"id": "645d87151694c57ce7af57c7",
"order": 1
},
{
"id": "645d87151694c57ce7af57d0",
"order": 10
},
{
"id": "645d87151694c57ce7af57cd",
"order": 7
},
{
"id": "645d87151694c57ce7af57c8",
"order": 2
},
{
"id": "645d87151694c57ce7af57cf",
"order": 9
}
],
"sharePassword": "jvLU",
"shareToken": "clabgenwipz4",
"subscriberCount": 0,
"type": "table",
"useSharePassword": false
}
},
"extra": null,
"message": "OK",
"requestID": null
}