跳到主要内容

创建表格行

请求

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

请求体

{
"cells": {
"6457589faf1c21691b34dab1":"312e9c2d153a853fb2d530fab21a242x",
"6457589faf1c21691b34dab2":"SunnyCity"
},
"prevRowId": "6457589faf1c21691b34dab3"
}

参数说明

NameTypeDescriptionRequired
cellsobjectrow cell infoY
prevRowIdstringprevious row id

Python 示例

def create_table_row(access_token, table_id, cells, prev_row_id):
url = '%s/open/api/v1/tablenodes/%d/rows/' % (API_HOST, table_id)
headers = {'Authorization': access_token}
data = {
"cells": cells,
"prevRowId": prev_row_id
}
req = requests.post(url, headers=headers, json=data)
return req.json()

响应

NameTypeDescription
detailobjectcreated row info
∟ addedViewRowsarrayadded view rows info
∟ cellsobjectadded cell info
∟ idstringrow id
∟ tableNodeIDint64table id

响应示例

{
"code": 0,
"detail": {
"addedViewRows": [
{
"id": "645f63f24444eb50dc9d63c1",
"order": 2.5625,
"viewID": "64575895af1c21691b34dab0"
}
],
"cells": {
"6457589faf1c21691b34dab1": "312e9c2d153a853fb2d530fab21a242x",
"6457589faf1c21691b34dab2": "SunnyCity"
},
"id": "645f63f24444eb50dc9d63c1",
"tableNodeID": 18
},
"extra": null,
"message": "OK",
"requestID": null
}