I’m trying to upload a file and then attach it to a record in Bika.
Step 1: Uploading the File
I successfully upload the file using this endpoint:
POST https://bika.ai/api/openapi/apitable/fusion/v1/datasheets/{{NODE_ID}}/attachments
Request body (as multipart/form-data
with the file in files
):
I receive the following response:
json
{
"success": true,
"code": 200,
"message": "SUCCESS",
"data": {
"size": 375820,
"url": "default/2YLFTYl5bynnVef4F3BRI.png"
}
}
Step 2: Attaching to a Record
Now I want to create or update a record and attach this file.
I’m trying this endpoint:
POST {{BASE_URL}}/api/openapi/bika/v1/spaces/{{SPACE_ID}}/resources/databases/{{NODE_ID}}/records
Request body:
json
{
"cells": {
"Content Idea": "Record with file (test)",
"storyGen": "Try using just path",
"files": {
"name": "example.png",
"path": "default/2YLFTYl5bynnVef4F3BRI.png",
"size": 375820
}
}
}
But the request fails.
Question:
How can I properly create or update a record with the uploaded file o as an attachment?
What is the correct format for the files
field in the cells
object?
Any working example or guidance would be appreciated!