Upload a knowledge base file

Updated at:

Uploads a Qoder CN knowledge base file using OpenAPI.

Important

The new Qoder CN documentation site is now available. Content on this site may not reflect the latest product features and changes. Visit docs.qoder.cn for the latest product documentation.

Supported editions

Enterprise Dedicated Edition, Enterprise Standard Edition

Service endpoints

Get the service endpoint and replace {domain} in the API request syntax with your endpoint.

Authorization

Product

Resource

Required permissions

Qoder CN

knowledge base file

Read-only

Request syntax

POST https://{domain}/oapi/v1/lingma/organizations/{organizationId}/knowledgeBases/{kbId}/files

Request

Enterprise Standard Edition

Upload file

curl -X 'POST' \
  'https://openapi-rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases/b15aef8442c0fc45492b****/files?name=test.pdf' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --form 'file=@"path/to/file"'

Enterprise Dedicated Edition

Upload file

curl -X 'POST' \
  'https://test-domain-***.rdc.aliyuncs.com/oapi/v1/lingma/organizations/6826e1d0516a9f85a08c****/knowledgeBases/b15aef8442c0fc45492b****/files?name=test.pdf' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --form 'file=@"path/to/file"'

Request headers

x-yunxiao-token string (Required)

Your personal access token. For more information, see access token.

Example: pt-0fh3****0fbG_35af****0484.

Request parameters

organizationId string (Required)

The ID of the organization. You can obtain the organizationId on the Basic Information page in the Organization Management Console.

kbId string (Required)

The ID of the knowledge base. To obtain this ID, see List knowledge bases.

name string (Optional)

The name of the file. The file extension must match that of the uploaded file.

file File (Required)

The file to upload. Add the file with the key file in the form-data section of the request body.

Response parameters

Successful response

{
    "fileId": "9536861f3bac806c6d14****",
    "operateUserId": "66a6f60e368d88cff5a5****",
    "success": true
}

Failed response

{
    "failedMessage": "This file type is not supported. Please upload a file in a supported format.",
    "operateUserId": "66a6f60e368d88cff5a5****",
    "success": false
}

failedMessage string

The error message that is returned if the request fails.

fileId string

The unique ID of the file.

operateUserId string

The ID of the user who performed the operation.

success boolean

Indicates whether the operation succeeded.

Error codes

For more information, see Error code center.