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
Name | Type | Description | Required |
---|---|---|---|
file | file | attachment file | Y |
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
Name | Type | Description |
---|---|---|
detail | object | attachment info |
∟ attachment | object | attachment info |
∟ attachments | array | attachment array |
∟ columnID | string | column id |
∟ projectID | int64 | project id |
∟ rowID | string | row id |
∟ tableNodeID | int64 | table 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
}