Skip to main content

Create table column

Request

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

Request example

{
"name": "columnName",
"type": "multiLineText",
"desc": "column description",
"prevColumnID": "645d87151694c57ce7af57c5",
"typeOptions": {}
}

Parameter description

NameTypeDescriptionRequired
namestringcolumn nameY
typestringcolumn typeY
descstringdescription
prevColumnIDstringprevious column id
typeOptionsobjecttype 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()

Response

NameTypeDescription
detailobjectcreated column info
∟ addedViewColumnsarrayadded view columns info
∟ descstringdescription
∟ idstringcolumn id
∟ modestringcolumn mode
∟ namestringcolumn name
∟ tableNodeIDint64table id
∟ typestringcolumn type
∟ typeOptionsobjecttype options
∟ updatedCellsobjectupdated cells

Response example

{
"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
}