POST
/
v1
/
file
/
upload_datasource

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:

Example response:

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

Authorizations

x-pd-api-key
string
headerrequired

Headers

Content-Type
string
required

The media type of the resource.

x-pd-api-agent-id
string
required

The ID of the data agent. If no data agent ID is available or you want to use the general mode, set it to GENERAL.

x-pd-external-trace-id
string

The external trace ID. The length ranges from 0 to 128 characters.

Body

multipart/form-data
file
file
required

The full path to the file.

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

Response

200 - application/json
code
integer
required

Status code. 0 indicates that the operation is successful. Otherwise, the operation fails. Possible error codes include:

  • 100: Bad request.
  • 201: Request frequency limit.
  • 9999: Internal error.
  • 100001: Invalid operation.
data
object
required

The returned data object.