Upload local files¶
Upload local files for use in creating or appending knowledge base sources. A successful upload only means that the file has been saved, but does not mean that the content is retrievable.
POST $CLOUDSIGMA_API_BASE/semantic-models/{model_id}/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. First query the knowledge base list to obtain the target knowledge base ID. Prepare a personal access token and target workspace ID that can access the target workspace.
Request parameters¶
curl -X POST "$CLOUDSIGMA_API_BASE/semantic-models/$MODEL_ID/local-files/upload" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-F "file=@./product-guide.pdf"
Submit the file using multipart/form-data. curl -F in the example will set the request header, do not add Content-Type: application/json.
Path parameters
Field |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
Target knowledge base ID. |
form fields
Field |
Type |
Required |
Description |
|---|---|---|---|
|
file |
Yes |
The local file to upload. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"file_id": "file_01"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
object |
The return data of this operation. |
|
string |
The ID of the uploaded file. Use this value when adding local file sources. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "file is required",
"data": null
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
Error description. |
|
null |
|