Upload local files before creation¶
Upload local files before creating the knowledge base. If the upload is successful, only the file ID to be bound will be returned. Must be bound as local_file source when creating knowledge base and adding data ](create-knowledge-base-with-sources.md).
POST $CLOUDSIGMA_API_BASE/semantic-models/local-files/upload
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare a personal access token and workspace ID that has the target workspace’s knowledge base permissions.
Request parameters¶
curl -X POST "$CLOUDSIGMA_API_BASE/semantic-models/local-files/upload" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-F "file=@./product-guide.pdf"
Use multipart/form-data to upload the file, and the form field name is file.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
file |
Yes |
The local file to upload. Pass it in using the |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"file_id": "file_01"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
object |
Upload results. |
|
string |
ID of the file to be bound. When creating the knowledge base, pass in |