How to quickly upload local files to create data sources
POST api/v1/datasets/{datasetId}/datasources
and POST /v1/datasources
endpoints allow you to upload your data in two methods:
url
parameter.
fileKey
parameter.
x-pd-api-key
header with your API key.
To get your API key, see Quick Start.
fileKey
fileKey
. Save this fileKey
to create a data source using the Create data source endpoint.
Supported file formats include: .csv, .tsv, .md, .mdx, .json, .txt, .pdf, .pptx, .ppt, .doc, .docx, .xls, and .xlsx.
Here’s an example in cURL:
<api-key>
with your actual API key.
<file_path>
with the actual full path to your file, for example, /Users/test/workspace/sales_2024.csv
.
fileKey
value from the response for later use. In this example, it is /tmp/sdgsagdsgsadgasdg
.
POST api/v1/datasets/{datasetId}/datasources
endpoint or the POST /v1/datasources
endpoint.
The example below demonstrates the use of the POST /v1/datasources
endpoint.
<api-key>
with your actual API key.fileKey
to your actual one.id
(data source ID) and datasetId
(dataset ID) for later use. In this example, the data source ID is datasource-cadsgfsdagasgadsg
and the dataset ID is dataset-dagasdgasgasg
.
GET v1/datasets/{datasetId}/datasources/{datasourceId}
endpoint.
Here’s an example:
synched
state and is ready for use in data analysis jobs.
Other possible statuses include:
pending
: Waiting to be processed.running
: Currently being processed.error
: Processing failed.pending
or running
, wait for some time and check again until it changes to synched
.If the status is error
, you’ll need to re-upload the file by starting from Step 1.