Skip to main content

Add attachment to cell

Add attachment to table cell, for image file, the maxmium file size is 20M.

Request

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

Request form-data example

{
"file": "attachment.csv"
}

Parameter description

NameTypeDescriptionRequired
filefileattachment fileY

Python example

def add_attachment(access_token, table_id, row_id, column_id, attachment_file_path):
url = '%s/open/api/v1/tablenodes/%d/rows/%s/cells/%s/attachments/' %( API_HOST, table_id, row_id,column_id)
files = {'file': open(attachment_file_path, 'rb')}
headers = {'Authorization': access_token}
req = requests.post(url, headers=headers, files=files)
return req.json()

Response

NameTypeDescription
detailobjectattachment info
∟ attachmentobjectattachment info
∟ attachmentsarrayattachment array
∟ columnIDstringcolumn id
∟ projectIDint64project id
∟ rowIDstringrow id
∟ tableNodeIDint64table id

Response example

{
"code": 0,
"detail": {
"attachment": {
"createTime": "2023-05-13T18:59:44.417622+08:00",
"fileExt": ".json",
"fileID": "clatxt69zta8",
"fileName": "test.json",
"fileSize": 161498,
"fileType": "application/json",
"uploaderID": 1,
"url": "https://hk-maptable-public.oss-cn-hongkong.aliyuncs.com/devfiles/clatxt69zta8"
},
"attachments": null,
"columnID": "645f6d304444eb50dc9d63c6",
"projectID": 2,
"rowID": "6457589faf1c21691b34dab3",
"tableNodeID": 40
},
"extra": null,
"message": "OK",
"requestID": null
}