curl --request POST \
--url https://ai.data.cloud/api/v1/team/datasources \
--header 'Content-Type: application/json' \
--header 'x-pd-api-key: <api-key>' \
--data '
{
"name": "test.csv",
"fileName": "test.csv",
"type": "FILE",
"url": "https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2",
"fileKey": "/tmp/sdgsagdsgsadgasdg",
"userId": "tmm-cm5m7khoz52zh07n4m7x1ut60"
}
'import requests
url = "https://ai.data.cloud/api/v1/team/datasources"
payload = {
"name": "test.csv",
"fileName": "test.csv",
"type": "FILE",
"url": "https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2",
"fileKey": "/tmp/sdgsagdsgsadgasdg",
"userId": "tmm-cm5m7khoz52zh07n4m7x1ut60"
}
headers = {
"x-pd-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-pd-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'test.csv',
fileName: 'test.csv',
type: 'FILE',
url: 'https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2',
fileKey: '/tmp/sdgsagdsgsadgasdg',
userId: 'tmm-cm5m7khoz52zh07n4m7x1ut60'
})
};
fetch('https://ai.data.cloud/api/v1/team/datasources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ai.data.cloud/api/v1/team/datasources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'test.csv',
'fileName' => 'test.csv',
'type' => 'FILE',
'url' => 'https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2',
'fileKey' => '/tmp/sdgsagdsgsadgasdg',
'userId' => 'tmm-cm5m7khoz52zh07n4m7x1ut60'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-pd-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ai.data.cloud/api/v1/team/datasources"
payload := strings.NewReader("{\n \"name\": \"test.csv\",\n \"fileName\": \"test.csv\",\n \"type\": \"FILE\",\n \"url\": \"https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2\",\n \"fileKey\": \"/tmp/sdgsagdsgsadgasdg\",\n \"userId\": \"tmm-cm5m7khoz52zh07n4m7x1ut60\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-pd-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://ai.data.cloud/api/v1/team/datasources")
.header("x-pd-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"test.csv\",\n \"fileName\": \"test.csv\",\n \"type\": \"FILE\",\n \"url\": \"https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2\",\n \"fileKey\": \"/tmp/sdgsagdsgsadgasdg\",\n \"userId\": \"tmm-cm5m7khoz52zh07n4m7x1ut60\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ai.data.cloud/api/v1/team/datasources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-pd-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"test.csv\",\n \"fileName\": \"test.csv\",\n \"type\": \"FILE\",\n \"url\": \"https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2\",\n \"fileKey\": \"/tmp/sdgsagdsgsadgasdg\",\n \"userId\": \"tmm-cm5m7khoz52zh07n4m7x1ut60\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"id": "datasource-cadsgfsdagasgadsg",
"datasetId": "dataset-dagasdgasgasg",
"name": "test.csv",
"fileName": "test.csv",
"type": "FILE",
"status": "pending"
}
}Create data source without specifying a dataset
Creates a data source without specifying a dataset. Powerdrill will automatically create a dataset for it.
curl --request POST \
--url https://ai.data.cloud/api/v1/team/datasources \
--header 'Content-Type: application/json' \
--header 'x-pd-api-key: <api-key>' \
--data '
{
"name": "test.csv",
"fileName": "test.csv",
"type": "FILE",
"url": "https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2",
"fileKey": "/tmp/sdgsagdsgsadgasdg",
"userId": "tmm-cm5m7khoz52zh07n4m7x1ut60"
}
'import requests
url = "https://ai.data.cloud/api/v1/team/datasources"
payload = {
"name": "test.csv",
"fileName": "test.csv",
"type": "FILE",
"url": "https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2",
"fileKey": "/tmp/sdgsagdsgsadgasdg",
"userId": "tmm-cm5m7khoz52zh07n4m7x1ut60"
}
headers = {
"x-pd-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-pd-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'test.csv',
fileName: 'test.csv',
type: 'FILE',
url: 'https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2',
fileKey: '/tmp/sdgsagdsgsadgasdg',
userId: 'tmm-cm5m7khoz52zh07n4m7x1ut60'
})
};
fetch('https://ai.data.cloud/api/v1/team/datasources', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ai.data.cloud/api/v1/team/datasources",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'test.csv',
'fileName' => 'test.csv',
'type' => 'FILE',
'url' => 'https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2',
'fileKey' => '/tmp/sdgsagdsgsadgasdg',
'userId' => 'tmm-cm5m7khoz52zh07n4m7x1ut60'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-pd-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ai.data.cloud/api/v1/team/datasources"
payload := strings.NewReader("{\n \"name\": \"test.csv\",\n \"fileName\": \"test.csv\",\n \"type\": \"FILE\",\n \"url\": \"https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2\",\n \"fileKey\": \"/tmp/sdgsagdsgsadgasdg\",\n \"userId\": \"tmm-cm5m7khoz52zh07n4m7x1ut60\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-pd-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://ai.data.cloud/api/v1/team/datasources")
.header("x-pd-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"test.csv\",\n \"fileName\": \"test.csv\",\n \"type\": \"FILE\",\n \"url\": \"https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2\",\n \"fileKey\": \"/tmp/sdgsagdsgsadgasdg\",\n \"userId\": \"tmm-cm5m7khoz52zh07n4m7x1ut60\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ai.data.cloud/api/v1/team/datasources")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-pd-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"test.csv\",\n \"fileName\": \"test.csv\",\n \"type\": \"FILE\",\n \"url\": \"https://s3.amazonaws.com/powerdrilltest/user/clvl4cad2001q01l1m522hxlu/upload/f9773f1e-cd68-489a-8121-d566ca9218b1.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240924T143419Z&X-Amz-SignedHeaders=host&X-Amz-Expires=599&X-Amz-Credential=AKIARLSQLXURHEIDN4OZ%2F20240924%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=9ca0c58d508926a5811818041d557ffb53c64025dae94c0855280d457c7089a2\",\n \"fileKey\": \"/tmp/sdgsagdsgsadgasdg\",\n \"userId\": \"tmm-cm5m7khoz52zh07n4m7x1ut60\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"id": "datasource-cadsgfsdagasgadsg",
"datasetId": "dataset-dagasdgasgasg",
"name": "test.csv",
"fileName": "test.csv",
"type": "FILE",
"status": "pending"
}
}Authorizations
Headers
The external trace ID. The length ranges from 0 to 128 characters.
Query Parameters
Your user ID.
How to obtain your user ID: Sign in to Powerdrill Enterprise, click Users in the top navigation bar, and find your user ID in the list of users.
Body
The name of the data source. If not provided, it will default to the value of fileName.
The file name, preferably including the file extension.
The type of the data source. Set it to FILE.
The URL of the file for public access.
Only files with the following extensions are supported: .csv, .tsv, .md, .mdx, .json, .txt, .pdf, .pptx, .ppt, .doc, .docx, .xls, or .xlsx.
You must specify either url or fileKey, but not both.
The object storage path to your locally uploaded file.
Only files with the following extensions are supported: .csv, .tsv, .md, .mdx, .json, .txt, .pdf, .pptx, .ppt, .doc, .docx, .xls, or .xlsx.
Each time you upload a file through the Upload file endpoint, its fileKey is returned. For more details, see How to Upload Local Files.
You must specify either url or fileKey, but not both.
Your user ID.
How to obtain your user ID: Sign in to Powerdrill Enterprise, click Users in the top navigation bar, and find your user ID in the list of users.
Response
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.
The returned data object.
Show child attributes
Show child attributes