POST api/v1/datasets/{datasetId}/datasources and POST /v1/datasources endpoints allow you to upload your data in two methods:
-
From a public URL: Use the
urlparameter. -
From your local storage: Use the
fileKeyparameter.
Authentication
All requests to Powerdrill must include anx-pd-api-key header with your API key.
To get your API key, see Quick Start.
Step 1. Upload your local file and obtain the fileKey
Use the POST /v1/file/upload_datasource endpoint to upload your local file. After the upload, the response will include a 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:
Example request:
Example response:
fileKey value from the response for later use. In this example, it is /tmp/sdgsagdsgsadgasdg.
Step 2. Create a data source
Now, create a data source to embed and synchronize it with your AI Workspace. You can do this by sending a request to either thePOST api/v1/datasets/{datasetId}/datasources endpoint or the POST /v1/datasources endpoint.
The example below demonstrates the use of the POST /v1/datasources endpoint.
Example request:
Example response:
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.
Step 3. Check data source status
The data source must be in the synched state to be ready for use. To check its status, use theGET v1/datasets/{datasetId}/datasources/{datasourceId} endpoint.
Here’s an example:
Example request
Example response:
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.