Presign data source
curl --request POST \
--url https://ai.data.cloud/api/v1/team/datasets/{datasetId}/datasources/{datasourceId}/presign \
--header 'Content-Type: application/json' \
--header 'x-pd-api-key: <api-key>' \
--data '
{
"expireIn": 600
}
'import requests
url = "https://ai.data.cloud/api/v1/team/datasets/{datasetId}/datasources/{datasourceId}/presign"
payload = { "expireIn": 600 }
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({expireIn: 600})
};
fetch('https://ai.data.cloud/api/v1/team/datasets/{datasetId}/datasources/{datasourceId}/presign', 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/datasets/{datasetId}/datasources/{datasourceId}/presign",
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([
'expireIn' => 600
]),
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/datasets/{datasetId}/datasources/{datasourceId}/presign"
payload := strings.NewReader("{\n \"expireIn\": 600\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/datasets/{datasetId}/datasources/{datasourceId}/presign")
.header("x-pd-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expireIn\": 600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ai.data.cloud/api/v1/team/datasets/{datasetId}/datasources/{datasourceId}/presign")
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 \"expireIn\": 600\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"presignedUrl": "string",
"expireAt": "2024-11-13T14:15:22.123Z"
}
}Data sources
Presign data source
Generates a presigned URL to access the specified data source.
POST
/
v1
/
team
/
datasets
/
{datasetId}
/
datasources
/
{datasourceId}
/
presign
Presign data source
curl --request POST \
--url https://ai.data.cloud/api/v1/team/datasets/{datasetId}/datasources/{datasourceId}/presign \
--header 'Content-Type: application/json' \
--header 'x-pd-api-key: <api-key>' \
--data '
{
"expireIn": 600
}
'import requests
url = "https://ai.data.cloud/api/v1/team/datasets/{datasetId}/datasources/{datasourceId}/presign"
payload = { "expireIn": 600 }
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({expireIn: 600})
};
fetch('https://ai.data.cloud/api/v1/team/datasets/{datasetId}/datasources/{datasourceId}/presign', 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/datasets/{datasetId}/datasources/{datasourceId}/presign",
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([
'expireIn' => 600
]),
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/datasets/{datasetId}/datasources/{datasourceId}/presign"
payload := strings.NewReader("{\n \"expireIn\": 600\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/datasets/{datasetId}/datasources/{datasourceId}/presign")
.header("x-pd-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expireIn\": 600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ai.data.cloud/api/v1/team/datasets/{datasetId}/datasources/{datasourceId}/presign")
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 \"expireIn\": 600\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"presignedUrl": "string",
"expireAt": "2024-11-13T14:15:22.123Z"
}
}Authorizations
Headers
The external trace ID. The length ranges from 0 to 128 characters.
Path Parameters
The ID of the dataset that contains the target data source.
The data source ID.
Body
application/json
The duration after which the presigned URL will expire. The value is expressed in seconds. The minimum value is 1 and is default to 600.
Required range:
x >= 60Response
200 - application/json
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
⌘I