Introduction

You can use this endpoint to upload your local file and then use the fileKey you obtained to create a data source through the Create data source endpoint.

Only files with the following extensions are supported: .csv, .tsv, .md, .mdx, .json, .txt, .pdf, .pptx, .ppt, .doc, .docx, .xls, or .xlsx.

Example request:

curl --location 'http://ai.data.cloud/api/v1/file/upload_datasource' \
--header 'Content-Type: multipart/form-data' \
--header 'x-pd-api-key: <api-key>' \
--header 'x-pd-api-agent-id: GENERAL' \
--form 'file=@"/Users/test/workspace/66C4547D0000650003AB1.xlsx"'

Example response:

200
{
  "code": 0,
  "data": {
    "fileKey": "/tmp/sdgsagdsgsadgasdg"
  }
}