Presign data source
curl --request POST \
--url https://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign \
--header 'Content-Type: application/json' \
--header 'x-pd-api-key: <api-key>' \
--data '
{
"expires_in": 600,
"user_id": "tmm-dafasdfasdfasdf"
}
'import requests
url = "https://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign"
payload = {
"expires_in": 600,
"user_id": "tmm-dafasdfasdfasdf"
}
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({expires_in: 600, user_id: 'tmm-dafasdfasdfasdf'})
};
fetch('https://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/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://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/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([
'expires_in' => 600,
'user_id' => 'tmm-dafasdfasdfasdf'
]),
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://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign"
payload := strings.NewReader("{\n \"expires_in\": 600,\n \"user_id\": \"tmm-dafasdfasdfasdf\"\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://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign")
.header("x-pd-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expires_in\": 600,\n \"user_id\": \"tmm-dafasdfasdfasdf\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/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 \"expires_in\": 600,\n \"user_id\": \"tmm-dafasdfasdfasdf\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"presigned_url": "string",
"expires_at": "2024-11-13T14:15:22.123Z"
}
}数据源
Presign data source
该接口用于为指定数据源生成一个预签名 URL(Presigned URL),从而您可以通过该 URL 下载对应的数据源。
预签名 URL 具有有效期,请确保在 URL 过期之前完成数据源的下载。
POST
/
v2
/
team
/
datasets
/
{dataset_id}
/
datasources
/
{datasource_id}
/
presign
Presign data source
curl --request POST \
--url https://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign \
--header 'Content-Type: application/json' \
--header 'x-pd-api-key: <api-key>' \
--data '
{
"expires_in": 600,
"user_id": "tmm-dafasdfasdfasdf"
}
'import requests
url = "https://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign"
payload = {
"expires_in": 600,
"user_id": "tmm-dafasdfasdfasdf"
}
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({expires_in: 600, user_id: 'tmm-dafasdfasdfasdf'})
};
fetch('https://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/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://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/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([
'expires_in' => 600,
'user_id' => 'tmm-dafasdfasdfasdf'
]),
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://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign"
payload := strings.NewReader("{\n \"expires_in\": 600,\n \"user_id\": \"tmm-dafasdfasdfasdf\"\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://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/presign")
.header("x-pd-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expires_in\": 600,\n \"user_id\": \"tmm-dafasdfasdfasdf\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.ai.relyt.cn/app/api/v2/team/datasets/{dataset_id}/datasources/{datasource_id}/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 \"expires_in\": 600,\n \"user_id\": \"tmm-dafasdfasdfasdf\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"data": {
"presigned_url": "string",
"expires_at": "2024-11-13T14:15:22.123Z"
}
}Authorizations
Headers
您本地系统中设置的 Trace ID,至多支持 128 个字符。当请求发生错误时,可以将此 ID 提供给 Relyt AI 团队,协助进行故障排查。
Path Parameters
目标数据源所在的数据集 ID。
如需查询您有访问权限的数据集列表,请调用 GET /v2/team/datasets 接口。
目标数据源 ID。
如需查询指定数据集中的数据源,请调用 GET /v2/team/datasets/{id}/datasources 接口。
Body
application/json
⌘I