创建数据表列
请求
curl -vvv "$API_HOST/open/api/v1/tablenodes/$table_id/columns/" -H "Content-Type: application/json" -H "Authorization: $access-token" -d '$request_body'
请求体
{
"name": "columnName",
"type": "multiLineText",
"desc": "column description",
"prevColumnID": "645d87151694c57ce7af57c5",
"typeOptions": {}
}
参数说明
Name | Type | Description | Required |
---|---|---|---|
name | string | column name | Y |
type | string | column type | Y |
desc | string | description | |
prevColumnID | string | previous column id | |
typeOptions | object | type options |
Python example
def create_table_column(access_token, table_id, name, type, prev_column_id, type_options):
url = '%s/open/api/v1/tablenodes/%d/columns/' % (API_HOST, table_id)
headers = {'Authorization': access_token}
data = {
"name": name,
"prevColumnID": prev_column_id,
"type": type,
"typeOptions": type_options,
}
req = requests.post(url, headers=headers, json=data)
return req.json()
响应
Name | Type | Description |
---|---|---|
detail | object | created column info |
∟ addedViewColumns | array | added view columns info |
∟ desc | string | description |
∟ id | string | column id |
∟ mode | string | column mode |
∟ name | string | column name |
∟ tableNodeID | int64 | table id |
∟ type | string | column type |
∟ typeOptions | object | type options |
∟ updatedCells | object | updated cells |
响应示例
{
"code": 0,
"detail": {
"addedViewColumns": [
{
"desc": null,
"id": "645f545d4444eb50dc9d63b6",
"order": 5.5,
"required": false,
"statsOption": null,
"title": null,
"viewID": "645d87141694c57ce7af57c0",
"width": 200
},
{
"desc": null,
"id": "645f545d4444eb50dc9d63b6",
"order": 5.5,
"required": false,
"statsOption": null,
"title": null,
"viewID": "645f3d0e4444eb50dc9d63af",
"width": 200
}
],
"desc": null,
"id": "645f545d4444eb50dc9d63b6",
"mode": "normal",
"name": "columnName",
"tableNodeID": 73,
"type": "multiLineText",
"typeOptions": null,
"updatedCells": null
},
"extra": null,
"message": "OK",
"requestID": null
}